var KOC = require("koc.common.utils");
var CommonUtils = require("../common-utils");

var Mysql_Helper = null;
var DBName = null;

module.exports = {
    //region 初始化
    Init: function (sql_helper, dbname) {
        if (!Mysql_Helper) {
            Mysql_Helper = sql_helper;
            DBName = dbname;
        }
        return this;
    },
    //endregion
    //region Family_Info:公会信息表
    Family_Info: {
        Info: function (Family_ID, callback) {
            var cacheParm = this.CacheParm.Info(Family_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        Info_UserID: function (User_ID, callback) {
            var sql = "SELECT * FROM `family_info` WHERE `User_ID` = :User_ID LIMIT 1;";
            Mysql_Helper.ExecuteRow(DBName, sql, {User_ID: User_ID}, callback);
        },
        Info_IDCard: function (IDCard, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT `User_ID` FROM `family_info` WHERE `IDCard` = :IDCard LIMIT 1;", {IDCard: IDCard}, callback);
        },
        Info_All: function (callback) {
            var sql = "SELECT * FROM `family_info` WHERE `Status` < 2 ;";
            Mysql_Helper.ExecuteTable(DBName, sql, {}, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `family_info`" +
                " (`User_ID`" +
                ", `Account_RealName`" +
                ", `Account_CardNo`" +
                ", `Account_BankName`" +
                ", `Account_BankFullName`" +
                ", `Account_Province`" +
                ", `Account_City`" +
                ", `IDCard`" +
                ", `ContactName`" +
                ", `Family_Name`" +
                ", `Phone`" +
                ", `QQ`" +
                ", `Email`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:User_ID" +
                ", :Account_RealName" +
                ", :Account_CardNo" +
                ", :Account_BankName" +
                ", :Account_BankFullName" +
                ", :Account_Province" +
                ", :Account_City" +
                ", :IDCard" +
                ", :ContactName" +
                ", :Family_Name" +
                ", :Phone" +
                ", :QQ" +
                ", :Email" +
                ", NOW()" +
                ", :Create_IP)";
            Value = KOC.Lodash.extend({
                IsAnchor: null,
                Account_RealName: null,
                Account_CardNo: null,
                Account_BankName: null,
                Account_BankFullName: null,
                Account_Province: null,
                Account_City: null,
                IDCard: null,//新方法将身份证写入user_info中 此处需删除
                ContactName: null,
                Family_Name: null,
                Phone: null,
                QQ: null,
                Email: null,
                User_ID: null,
                Create_IP: null
            }, Value);
            if (!Value.User_ID) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:User_ID"
                }));
            }
            if (Value.Phone && !(/^1\d{10}$/).test(Value.Phone)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "手机号码不正确：" + Value.Phone
                }));
                return;
            }
            if (Value.Email && !(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/).test(Value.Email)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "邮箱格式不正确：" + Value.Email
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update: function (Value, callback) {
            var sql = "UPDATE `family_info`" +
                " SET `Family_Name` = :Family_Name" +
                " WHERE `Family_ID` = :Family_ID" +
                " AND `Status` = 0;";
            Value = KOC.Lodash.extend({
                Family_Name: null,
                Family_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.Family_ID));
        },
        Update_AnchorNum: function (Conn, Value, callback) {
            var sql = "UPDATE `family_info`" +
                " SET `Anchor_Num` = `Anchor_Num` + :Type" +
                " WHERE `Family_ID` = :Family_ID" +
                " AND `Status` = 0" +
                " AND :Type IN (-1, 1)" +
                " AND `Anchor_Num` + :Type >= 0;";
            Value = KOC.Lodash.extend({
                Family_ID: null,
                Type: null//修改类型，1-数量加一，-1-数量减一
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Family_ID));
        },
        Update_Apply: function (Conn, Value, callback) {
            var sql = "UPDATE `family_info`" +
                " SET `Account_RealName` = :Account_RealName" +
                ", `Account_CardNo` = :Account_CardNo" +
                ", `Account_BankName` = :Account_BankName" +
                ", `Account_BankFullName` = :Account_BankFullName" +
                ", `Account_Province` = :Account_Province" +
                ", `Account_City` = :Account_City" +
                ", `IDCard` = :IDCard" +
                ", `ContactName` = :ContactName" +
                ", `Family_Name` = :Family_Name" +
                ", `Phone` = :Phone" +
                ", `QQ` = :QQ" +
                ", `Email` = :Email" +
                ", `User_ID` = :User_ID" +
                ", `Create_IP` = :Create_IP" +
                ", `Status` = 2" +
                " WHERE `Family_ID` = :Family_ID" +
                " AND `Status` = 3;";
            Value = KOC.Lodash.extend({
                Family_ID: null,
                Account_RealName: null,
                Account_CardNo: null,
                Account_BankName: null,
                Account_BankFullName: null,
                Account_Province: null,
                Account_City: null,
                IDCard: null,//新方法将身份证写入user_info中 此处需删除
                ContactName: null,
                Family_Name: null,
                Phone: null,
                QQ: null,
                Email: null,
                User_ID: null,
                Create_IP: null
            }, Value);
            if (Value.Phone && !(/^1\d{10}$/).test(Value.Phone)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "手机号码不正确：" + Value.Phone
                }));
                return;
            }
            if (Value.Email && !(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/).test(Value.Email)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "邮箱格式不正确：" + Value.Email
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Status: function (Conn, Value, callback) {
            var sql = "UPDATE `family_info`" +
                " SET `Status` = :Status" +
                ", `IDCard` = CASE :Status WHEN 3 THEN NULL ELSE `IDCard` END" +
                ", `IDCard_Status` = CASE :Status WHEN 3 THEN -1 ELSE `IDCard_Status` END" +
                " WHERE `Family_ID` = :Family_ID" +
                " AND CASE :Status WHEN 0 THEN (`Status` = 1 OR `Status` = 2) ELSE (" +
                " CASE :Status WHEN 1 THEN `Status` = 0 ELSE `Status` = 2 END) END;";
            Value = KOC.Lodash.extend({
                Family_ID: null,
                Status: null//申请成功/解锁-0，锁定-1 申请失败-3
            }, Value);
            Value.Status = KOC.StringUtils.ToInt(Value.Status, -1);
            if (!KOC.Lodash.includes([0, 1, 3], Value.Status)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Status"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback, this.CacheParm.Info(Value.Family_ID));
        },
        Update_Bank: function (Conn, Value, callback) {
            var sql = "UPDATE `family_info`" +
                " SET `Beans` = `Beans` + (:Trade_Flag * :Trade_Amt)" +
                ", `Beans_Total` = `Beans_Total` + CASE :Trade_Flag WHEN 1 THEN :Trade_Amt ELSE 0 END" +
                " WHERE `Family_ID` = :Family_ID" +
                " AND `Beans` + (:Trade_Flag * :Trade_Amt) >= 0" +
                " AND :Trade_Flag IN (-1, 1)" +
                " AND :Trade_Amt > 0" +
                " AND ROUND(:Trade_Amt) = :Trade_Amt;";
            Value = KOC.Lodash.extend({
                Trade_Flag: null,
                Trade_Amt: null,
                Family_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Family_ID));
        },
        Update_Account: function (Value, callback) {
            var sql = "UPDATE `family_info`" +
                " SET `Account_BankName` = CASE WHEN :Account_BankName IS NOT NULL THEN :Account_BankName ELSE `Account_BankName` END" +
                ", `ContactName` = CASE WHEN :ContactName IS NOT NULL THEN :ContactName ELSE `ContactName` END" +
                ", `Account_BankFullName` = CASE WHEN :Account_BankFullName IS NOT NULL THEN :Account_BankFullName ELSE `Account_BankFullName` END" +
                ", `Account_Province` = CASE WHEN :Account_Province IS NULL THEN `Account_Province` ELSE :Account_Province END" +
                ", `Account_City` = CASE WHEN :Account_City IS NULL THEN `Account_City` ELSE :Account_City END" +
                ", `Account_RealName` = CASE WHEN :Account_RealName IS NOT NULL THEN :Account_RealName ELSE `Account_RealName` END" +
                ", `Account_CardNo` = CASE WHEN :Account_CardNo IS NOT NULL THEN :Account_CardNo ELSE `Account_CardNo` END" +
                ", `IDCard` = CASE WHEN :IDCard IS NOT NULL THEN :IDCard ELSE `IDCard` END" +
                " WHERE `Family_ID` = :Family_ID" +
                " AND `Status` = 0;";
            Value = KOC.Lodash.extend({
                Family_ID: null,
                Account_BankName: null,
                Account_BankFullName: null,
                Account_Province: null,
                Account_City: null,
                Account_RealName: null,
                Account_CardNo: null,
                IDCard: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.Family_ID));
        },
        Update_ApproveAdmin: function (Conn, Value, callback) {
            var sql = "UPDATE `family_info`" +
                " SET `Approve_Admin_ID` = :Approve_Admin_ID" +
                ", `Approve_RealName` = :Approve_RealName" +
                ", `Approve_Date` = NOW()" +
                " WHERE `Family_ID` = :Family_ID" +
                " AND :Approve_Admin_ID > 0;";
            Value = KOC.Lodash.extend({
                Family_ID: null,
                Approve_Admin_ID: null,
                Approve_RealName: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Family_ID));
        },
        List: function (Value, callback) {
            Value = KOC.Lodash.extend({
                Limit: 0,
                FuzzyQuery: "",
                Family_ID: 0,
                Family_Name: "",
                User_ID: 0,
                Phone: "",
                Status: "0"
            }, Value);
            var sql = "";
            Value.FuzzyQuery = KOC.StringUtils.ToString(Value.FuzzyQuery);
            if (Value.FuzzyQuery.trim()) {
                Value.FuzzyQueryLike = "%" + Value.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_Name` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(Value.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Phone` = :FuzzyQuery", "OR");
                }
                sql = Mysql_Helper.AddToWhereSQL(sql, _Condition_FuzzyQuery, "AND");
            }
            Value.Family_ID = KOC.StringUtils.ToIntPositive(Value.Family_ID);
            if (Value.Family_ID) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`Family_ID` = :Family_ID", "AND");
            }
            if (Value.Family_Name) {
                Value.Family_Name = "%" + Value.Family_Name + "%";
                sql = Mysql_Helper.AddToWhereSQL(sql, "`Family_Name` LIKE :Family_Name", "AND");
            }
            Value.User_ID = KOC.StringUtils.ToIntPositive(Value.User_ID);
            if (Value.User_ID) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`User_ID` = :User_ID", "AND");
            }
            if (Value.Phone) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`Phone` = :Phone", "AND");
            }
            var _Status = [];
            KOC.Lodash.forEach(String(Value.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                Value.Status = _Status;
                sql = Mysql_Helper.AddToWhereSQL(sql, "`Status` IN (:Status)", "AND");
            }
            sql = "SELECT * FROM `family_info`"
                + (sql ? " WHERE " + sql : "")
                + (Value.Limit > 0 ? " LIMIT :Limit" : "")
                + ";";
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        },
        CacheParm: {
            Info: function (Family_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `family_info` WHERE `Family_ID` = :Family_ID LIMIT 1;",
                    Parm: {Family_ID: KOC.StringUtils.ToIntPositive(Family_ID)}
                };
            }
        }
    },
    //endregion
    //region Family_Bank_Trade:公会帐户资金(金豆)交易记录
    Family_Bank_Trade: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `family_bank_trade`" +
                "(`Family_ID`" +
                ", `Family_Name`" +
                ", `Related_User_ID`" +
                ", `Related_User_NickName`" +
                ", `Related_User_RealName`" +
                ", `Related_Anchor_ID`" +
                ", `Related_Anchor_NickName`" +
                ", `Related_Anchor_RealName`" +
                ", `Trade_Type`" +
                ", `Trade_Type_Name`" +
                ", `Trade_Flag`" +
                ", `Trade_Amt`" +
                ", `Trade_Order_No`" +
                ", `Amt`" +
                ", `Remark`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " SELECT `Family_ID`" +
                ", `Family_Name`" +
                ", :Related_User_ID" +
                ", :Related_User_NickName" +
                ", :Related_User_RealName" +
                ", :Related_Anchor_ID" +
                ", :Related_Anchor_NickName" +
                ", :Related_Anchor_RealName" +
                ", :Trade_Type" +
                ", :Trade_Type_Name" +
                ", :Trade_Flag" +
                ", :Trade_Amt" +
                ", :Trade_Order_No" +
                ", `Beans`" +
                ", :Remark" +
                ", NOW()" +
                ", :Create_IP" +
                " FROM `family_info`" +
                " WHERE `Family_ID` = :Family_ID" +
                " AND :Trade_Flag IN (1, -1)" +
                " AND :Trade_Amt > 0" +
                " AND ROUND(:Trade_Amt) = :Trade_Amt;";
            Value = KOC.Lodash.extend({
                Family_ID: null,
                Related_User_ID: null,
                Related_User_NickName: null,
                Related_User_RealName: null,
                Related_Anchor_ID: null,
                Related_Anchor_NickName: null,
                Related_Anchor_RealName: null,
                Trade_Type: null,
                Trade_Type_Name: null,
                Trade_Flag: null,
                Trade_Amt: null,
                Trade_Order_No: null,
                Remark: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        }
    },
    //endregion
    //region User_Info:用户信息表
    User_Info: {
        Info: function (User_ID, callback) {
            var cacheParm = this.CacheParm.Info(User_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.VIP_Expire))) {
                        retValue.returnObject.VIP = 0;
                    }
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire) {
                        retValue.returnObject.VIP_ExpireDay = KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days");
                    }
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(retValue.returnObject.EXP);
                    retValue.returnObject.Level = _LevelInfo.Level;
                    retValue.returnObject.Level_Name = _LevelInfo.Level_Name;
                    retValue.returnObject.Level_Next = _LevelInfo.Level_Next;
                    retValue.returnObject.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    retValue.returnObject.EXP_Next = _LevelInfo.EXP_Next;
                    retValue.returnObject.EXP_Difference = _LevelInfo.Difference;
                }
                callback(retValue);
            });
        },
        Info_NickName: function (NickName, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT `User_ID` FROM `user_info`" +
                " WHERE `NickName` = :NickName" +
                " LIMIT 1;", {
                NickName: NickName
            }, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.VIP_Expire))) {
                        retValue.returnObject.VIP = 0;
                    }
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire) {
                        retValue.returnObject.VIP_ExpireDay = KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days");
                    }
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(retValue.returnObject.EXP);
                    retValue.returnObject.Level = _LevelInfo.Level;
                    retValue.returnObject.Level_Name = _LevelInfo.Level_Name;
                    retValue.returnObject.Level_Next = _LevelInfo.Level_Next;
                    retValue.returnObject.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    retValue.returnObject.EXP_Next = _LevelInfo.EXP_Next;
                    retValue.returnObject.EXP_Difference = _LevelInfo.Difference;
                }
                callback(retValue);
            });
        },
        Info_Login: function (LoginName, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT *" +
                " FROM `user_info`" +
                " WHERE `Phone` = :LoginName" +
                " OR `Email` = :LoginName" +
                " LIMIT 1;", {
                LoginName: LoginName
            }, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.VIP_Expire))) {
                        retValue.returnObject.VIP = 0;
                    }
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire) {
                        retValue.returnObject.VIP_ExpireDay = KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days");
                    }
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(retValue.returnObject.EXP);
                    retValue.returnObject.Level = _LevelInfo.Level;
                    retValue.returnObject.Level_Name = _LevelInfo.Level_Name;
                    retValue.returnObject.Level_Next = _LevelInfo.Level_Next;
                    retValue.returnObject.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    retValue.returnObject.EXP_Next = _LevelInfo.EXP_Next;
                    retValue.returnObject.EXP_Difference = _LevelInfo.Difference;
                }
                callback(retValue);
            });
        },
        Info_OAuthQQ: function (OAuth_QQ_ID, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT *" +
                " FROM `user_info`" +
                " WHERE `OAuth_QQ_ID` = :OAuth_QQ_ID" +
                " LIMIT 1;", {
                OAuth_QQ_ID: OAuth_QQ_ID
            }, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.VIP_Expire))) {
                        retValue.returnObject.VIP = 0;
                    }
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire) {
                        retValue.returnObject.VIP_ExpireDay = KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days");
                    }
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(retValue.returnObject.EXP);
                    retValue.returnObject.Level = _LevelInfo.Level;
                    retValue.returnObject.Level_Name = _LevelInfo.Level_Name;
                    retValue.returnObject.Level_Next = _LevelInfo.Level_Next;
                    retValue.returnObject.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    retValue.returnObject.EXP_Next = _LevelInfo.EXP_Next;
                    retValue.returnObject.EXP_Difference = _LevelInfo.Difference;
                }
                callback(retValue);
            });
        },
        Info_OAuthWeibo: function (OAuth_Weibo_ID, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT *" +
                " FROM `user_info`" +
                " WHERE `OAuth_Weibo_ID` = :OAuth_Weibo_ID" +
                " LIMIT 1;", {
                OAuth_Weibo_ID: OAuth_Weibo_ID
            }, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.VIP_Expire))) {
                        retValue.returnObject.VIP = 0;
                    }
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire) {
                        retValue.returnObject.VIP_ExpireDay = KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days");
                    }
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(retValue.returnObject.EXP);
                    retValue.returnObject.Level = _LevelInfo.Level;
                    retValue.returnObject.Level_Name = _LevelInfo.Level_Name;
                    retValue.returnObject.Level_Next = _LevelInfo.Level_Next;
                    retValue.returnObject.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    retValue.returnObject.EXP_Next = _LevelInfo.EXP_Next;
                    retValue.returnObject.EXP_Difference = _LevelInfo.Difference;
                }
                callback(retValue);
            });
        },
        Info_OAuthWeixin: function (OAuth_Weixin_UNIONID, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT *" +
                " FROM `user_info`" +
                " WHERE `OAuth_Weixin_UNIONID` = :OAuth_Weixin_UNIONID" +
                " LIMIT 1;", {
                OAuth_Weixin_UNIONID: OAuth_Weixin_UNIONID
            }, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.VIP_Expire))) {
                        retValue.returnObject.VIP = 0;
                    }
                    if (retValue.returnObject.VIP && retValue.returnObject.VIP_Expire) {
                        retValue.returnObject.VIP_ExpireDay = KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(retValue.returnObject.VIP_Expire).diff(KOC.Moment(), "days");
                    }
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(retValue.returnObject.EXP);
                    retValue.returnObject.Level = _LevelInfo.Level;
                    retValue.returnObject.Level_Name = _LevelInfo.Level_Name;
                    retValue.returnObject.Level_Next = _LevelInfo.Level_Next;
                    retValue.returnObject.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    retValue.returnObject.EXP_Next = _LevelInfo.EXP_Next;
                    retValue.returnObject.EXP_Difference = _LevelInfo.Difference;
                }
                callback(retValue);
            });
        },
        //*******************************!!!!!!!改
        Info_IPCount: function (callback) {
            var sql = "SELECT DATE_FORMAT(NOW(), '%Y-%c-%d') AS Today" +
                ", COUNT(DISTINCT `Create_IP`) AS `IP_Count` FROM `user_info`;";
            Mysql_Helper.ExecuteRow(DBName, sql, {}, callback);
        },
        //*******************************!!!!!!!改
        Info_UserCountDay: function (callback) {
            var sql = "SELECT COUNT(*) AS `User_Count`" +
                " FROM `user_info`" +
                " WHERE DATE_FORMAT(NOW(), :formate) = DATE_FORMAT(`Create_Date`, :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        //*******************************!!!!!!!改
        Info_UserCountALL: function (callback) {
            var sql = "SELECT" +
                " COUNT(*) AS `User_Count`" +
                " FROM `user_info`;";
            Mysql_Helper.ExecuteRow(DBName, sql, {}, callback);
        },
        //*******************************!!!!!!!改
        Info_UserCountLogin: function (callback) {
            var sql = "SELECT" +
                " COUNT(*) AS `User_Count`" +
                " FROM `user_info`" +
                " WHERE DATE_FORMAT(NOW(), '%Y-%c-%d') = DATE_FORMAT(`Login_This_Date`, '%Y-%c-%d');";
            Mysql_Helper.ExecuteRow(DBName, sql, {}, callback);
        },
        //*******************************!!!!!!!改
        Info_Phone: function (Phone, callback) {
            var sql = "SELECT * FROM `user_info` WHERE `Phone` = :Phone LIMIT 1;";
            Mysql_Helper.ExecuteRow(DBName, sql, {Phone: Phone}, callback);
        },
        //*******************************!!!!!!!改
        Info_SignUp_Channel: function (Value, callback) {
            var sql = "SELECT `Channel_ID`" +
                ", COUNT(`User_ID`) AS `User_ID_Count`" +
                " FROM `koc-anchor-user`.`user_info`" +
                " WHERE `Channel_ID` > 0" +
                " AND `Create_Date` >= :Create_Date_Between" +
                " AND `Create_Date` <= :Create_Date_And";
            Value = KOC.Lodash.extend({
                Create_Date_Between: null,
                Create_Date_And: null,
                Channel_ID: null
            }, Value);
            if (Value.Channel_ID == -1) {
                sql += " AND `Channel_ID` IN(118060101, 118060102, 118060103,118060104)";
            } else {
                sql += " AND `Channel_ID` IN(:Channel_ID)";
            }
            sql += "GROUP BY `Channel_ID`" +
                " ORDER BY `Channel_ID` DESC";
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        },
        //*******************************!!!!!!!改
        Info_SignUp_Pay: function (Value, callback) {
            var sql = "SELECT `user_info`.`Channel_ID`" +
                ", COUNT( `order_pay`.`User_ID`) AS `User_ID_Count`" +//-- 充值人次
                ", COUNT(DISTINCT `order_pay`.`User_ID`) AS `User_ID_Number`" +  //-- 充值人数
                ", SUM(`order_pay`.`Pay_Money`) AS `SUM_Money`" +              //-- 充值钱数
                ", SUM(`order_pay`.`Pay_Coin`) AS `SUM_Coin`" +               //-- 充值金币数
                " FROM `koc-anchor-user`.`order_pay`" +
                " JOIN (SELECT `User_ID`" +
                ", `Channel_ID`" +
                " FROM `koc-anchor-user`.`user_info`" +
                " WHERE `Channel_ID` > 0";
            Value = KOC.Lodash.extend({
                Create_Date_Between: null,
                Create_Date_And: null,
                Channel_ID: null
            }, Value);
            if (Value.Channel_ID == -1) {
                sql += " AND `Channel_ID` IN(118060101, 118060102, 118060103,118060104)";
            } else {
                sql += " AND `Channel_ID` IN(:Channel_ID)";
            }
            sql += " AND `Create_Date` >= :Create_Date_Between" +
                " AND `Create_Date` <= :Create_Date_And) AS `user_info`" +
                " ON `user_info`.`User_ID` = `order_pay`.`User_ID`" +
                " WHERE `order_pay`.`Update_Date` >= :Create_Date_Between" +
                " AND `order_pay`.`Update_Date` <= :Create_Date_And" +
                " AND `order_pay`.`Status` = 0" +
                " GROUP BY `user_info`.`Channel_ID`" +
                " ORDER BY `user_info`.`Channel_ID` DESC;";
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        },
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `user_info`" +
                " (`Password`" +
                ", `NickName`" +
                ", `Phone`" +
                ", `Channel_ID`" +
                ", `Inviter_ID`" +
                ", `Inviter_NickName`" +
                ", `SignUp_Anchor_ID`" +
                ", `SignUp_Anchor_Family_ID`" +
                ", `SignUp_Origin`" +
                ", `SignUp_Url`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Password" +
                ", :NickName" +
                ", :Phone" +
                ", :Channel_ID" +
                ", CASE WHEN :Inviter_ID > 0 THEN :Inviter_ID ELSE -1 END" +
                ", :Inviter_NickName" +
                ", CASE WHEN :Room_ID > 0 THEN :Room_ID ELSE -1 END" +
                ", CASE WHEN :Family_ID > 0 THEN :Family_ID ELSE -1 END" +
                ", :SignUp_Origin" +
                ", :SignUp_Url" +
                ", NOW()" +
                ", :Create_IP)";
            Value = KOC.Lodash.extend({
                Channel_ID: null,
                Inviter_ID: null,
                Inviter_NickName: null,
                Room_ID: null,
                Family_ID: null,
                Password: null,
                NickName: null,
                Phone: null,
                SignUp_Origin: null,
                SignUp_Url: "",
                Create_IP: null
            }, Value);
            Value.Password = KOC.StringUtils.MD5(Value.Password);
            Value.NickName = Value.NickName ? Value.NickName.replace(/ /g, "").replace(/　/g, "") : null;
            Value.SignUp_Origin = KOC.StringUtils.ToInt(Value.SignUp_Origin, -1);
            if (!Value.Channel_ID || Value.Channel_ID <= 0) {
                Value.Channel_ID = null;
            }
            if (!Value.Phone || !(/^1\d{10}$/).test(Value.Phone)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "手机号码不正确：" + Value.Phone
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Insert_OAuthQQ: function (Value, callback) {
            var sql = "INSERT INTO `user_info`" +
                " (`OAuth_QQ_ID`" +
                ", `OAuth_QQ_Token`" +
                ", `OAuth_QQ_TokenCreate`" +
                ", `OAuth_QQ_ExpiresIn`" +
                ", `OAuth_QQ_RefreshToken`" +
                ", `NickName`" +
                ", `Sex`" +
                ", `Channel_ID`" +
                ", `Inviter_ID`" +
                ", `Inviter_NickName`" +
                ", `SignUp_Anchor_ID`" +
                ", `SignUp_Anchor_Family_ID`" +
                ", `SignUp_Origin`" +
                ", `SignUp_Url`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:OAuth_QQ_ID" +
                ", :OAuth_QQ_Token" +
                ", NOW()" +
                ", :OAuth_QQ_ExpiresIn" +
                ", :OAuth_QQ_RefreshToken" +
                ", :NickName" +
                ", :Sex" +
                ", :Channel_ID" +
                ", CASE WHEN :Inviter_ID > 0 THEN :Inviter_ID ELSE -1 END" +
                ", :Inviter_NickName" +
                ", CASE WHEN :Room_ID > 0 THEN :Room_ID ELSE -1 END" +
                ", CASE WHEN :Family_ID > 0 THEN :Family_ID ELSE -1 END" +
                ", :SignUp_Origin" +
                ", :SignUp_Url" +
                ", NOW()" +
                ", :Create_IP)";
            Value = KOC.Lodash.extend({
                OAuth_QQ_ID: null,
                OAuth_QQ_Token: null,
                OAuth_QQ_ExpiresIn: null,
                OAuth_QQ_RefreshToken: null,
                NickName: null,
                Sex: null,
                Channel_ID: null,
                Inviter_ID: null,
                Inviter_NickName: null,
                Room_ID: null,
                Family_ID: null,
                SignUp_Origin: null,
                SignUp_Url: "",
                Create_IP: ""
            }, Value);
            Value.SignUp_Origin = KOC.StringUtils.ToInt(Value.SignUp_Origin, -1);
            if (!Value.Channel_ID || Value.Channel_ID <= 0) {
                Value.Channel_ID = null;
            }
            if (!Value.Inviter_ID || Value.Inviter_ID <= 0) {
                Value.Inviter_ID = null;
            }
            if (!Value.OAuth_QQ_ID || !Value.OAuth_QQ_Token || !(Value.OAuth_QQ_ExpiresIn > 0)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.Sex)) {
                Value.Sex = 1;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Insert_OAuthWeibo: function (Value, callback) {
            var sql = "INSERT INTO `user_info`" +
                " (`OAuth_Weibo_ID`" +
                ", `OAuth_Weibo_Token`" +
                ", `OAuth_Weibo_TokenCreate`" +
                ", `OAuth_Weibo_ExpiresIn`" +
                ", `NickName`" +
                ", `Sex`" +
                ", `Channel_ID`" +
                ", `Inviter_ID`" +
                ", `Inviter_NickName`" +
                ", `SignUp_Anchor_ID`" +
                ", `SignUp_Anchor_Family_ID`" +
                ", `SignUp_Origin`" +
                ", `SignUp_Url`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:OAuth_Weibo_ID" +
                ", :OAuth_Weibo_Token" +
                ", NOW()" +
                ", :OAuth_Weibo_ExpiresIn" +
                ", :NickName" +
                ", :Sex" +
                ", :Channel_ID" +
                ", CASE WHEN :Inviter_ID > 0 THEN :Inviter_ID ELSE -1 END" +
                ", :Inviter_NickName" +
                ", CASE WHEN :Room_ID > 0 THEN :Room_ID ELSE -1 END" +
                ", CASE WHEN :Family_ID > 0 THEN :Family_ID ELSE -1 END" +
                ", :SignUp_Origin" +
                ", :SignUp_Url" +
                ", NOW()" +
                ", :Create_IP)";
            Value = KOC.Lodash.extend({
                OAuth_Weibo_ID: null,
                OAuth_Weibo_Token: null,
                OAuth_Weibo_ExpiresIn: null,
                NickName: null,
                Sex: null,
                Channel_ID: null,
                Inviter_ID: null,
                Inviter_NickName: null,
                Room_ID: null,
                Family_ID: null,
                SignUp_Origin: null,
                SignUp_Url: "",
                Create_IP: ""
            }, Value);
            Value.SignUp_Origin = KOC.StringUtils.ToInt(Value.SignUp_Origin, -1);
            if (!Value.Channel_ID || Value.Channel_ID <= 0) {
                Value.Channel_ID = null;
            }
            if (!Value.Inviter_ID || Value.Inviter_ID <= 0) {
                Value.Inviter_ID = null;
            }
            if (!Value.OAuth_Weibo_ID || !Value.OAuth_Weibo_Token || !(Value.OAuth_Weibo_ExpiresIn > 0)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.Sex)) {
                Value.Sex = 1;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Insert_OAuthWeixin: function (Value, callback) {
            var sql = "INSERT INTO `user_info`" +
                " (`OAuth_Weixin_ID`" +
                ", `OAuth_Weixin_UNIONID`" +
                ", `OAuth_Weixin_Token`" +
                ", `OAuth_Weixin_TokenCreate`" +
                ", `OAuth_Weixin_ExpiresIn`" +
                ", `OAuth_Weixin_RefreshToken`" +
                ", `NickName`" +
                ", `Sex`" +
                ", `Channel_ID`" +
                ", `Inviter_ID`" +
                ", `Inviter_NickName`" +
                ", `SignUp_Anchor_ID`" +
                ", `SignUp_Anchor_Family_ID`" +
                ", `SignUp_Origin`" +
                ", `SignUp_Url`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:OAuth_Weixin_ID" +
                ", :OAuth_Weixin_UNIONID" +
                ", :OAuth_Weixin_Token" +
                ", NOW()" +
                ", :OAuth_Weixin_ExpiresIn" +
                ", :OAuth_Weixin_RefreshToken" +
                ", :NickName" +
                ", :Sex" +
                ", :Channel_ID" +
                ", CASE WHEN :Inviter_ID > 0 THEN :Inviter_ID ELSE -1 END" +
                ", :Inviter_NickName" +
                ", CASE WHEN :Room_ID > 0 THEN :Room_ID ELSE -1 END" +
                ", CASE WHEN :Family_ID > 0 THEN :Family_ID ELSE -1 END" +
                ", :SignUp_Origin" +
                ", :SignUp_Url" +
                ", NOW()" +
                ", :Create_IP)";
            Value = KOC.Lodash.extend({
                OAuth_Weixin_ID: null,
                OAuth_Weixin_UNIONID: null,
                OAuth_Weixin_Token: null,
                OAuth_Weixin_ExpiresIn: null,
                OAuth_Weixin_RefreshToken: null,
                NickName: null,
                Sex: null,
                Channel_ID: null,
                Inviter_ID: null,
                Inviter_NickName: null,
                Room_ID: null,
                Family_ID: null,
                SignUp_Origin: null,
                SignUp_Url: "",
                Create_IP: ""
            }, Value);
            Value.SignUp_Origin = KOC.StringUtils.ToInt(Value.SignUp_Origin, -1);
            if (!Value.Channel_ID || Value.Channel_ID <= 0) {
                Value.Channel_ID = null;
            }
            if (!Value.Inviter_ID || Value.Inviter_ID <= 0) {
                Value.Inviter_ID = null;
            }
            if (!Value.OAuth_Weixin_ID || !Value.OAuth_Weixin_Token || !(Value.OAuth_Weixin_ExpiresIn > 0)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.Sex)) {
                Value.Sex = 1;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Insert_OAuthPhone: function (Value, callback) {
            var sql = "INSERT INTO `user_info`" +
                " (`Phone`" +
                ", `Password`" +
                ", `NickName`" +
                ", `Channel_ID`" +
                ", `SignUp_Origin`" +
                ", `SignUp_Url`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Phone" +
                ", :Password" +
                ", :NickName" +
                ", :Channel_ID" +
                ", :SignUp_Origin" +
                ", :SignUp_Url" +
                ", NOW()" +
                ", :Create_IP)";
            Value = KOC.Lodash.extend({
                Phone: null,
                Password: null,
                NickName: null,
                Channel_ID: null,
                SignUp_Origin: null,
                SignUp_Url: null,
                Create_IP: ""
            }, Value);
            Value.Password = KOC.StringUtils.MD5(Value.Password);
            Value.SignUp_Origin = KOC.StringUtils.ToInt(Value.SignUp_Origin, -1);
            if (!Value.Channel_ID || Value.Channel_ID <= 0) {
                Value.Channel_ID = null;
            }
            if (!Value.Phone || !(/^1\d{10}$/).test(Value.Phone)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "手机号码不正确：" + Value.Phone
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Update: function (Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `NickName` = IFNULL(:NickName, `NickName`)" +
                ", `QQ` = IFNULL(:QQ, `QQ`)" +
                ", `Sex` = IFNULL(:Sex, `Sex`)" +
                ", `Signature` = IFNULL(:Signature, `Signature`)" +
                ", `Birthday` = IFNULL(:Birthday, `Birthday`)" +
                ", `Constellation` = IFNULL(:Constellation, `Constellation`)" +
                " WHERE `User_ID` = :User_ID" +
                " AND :Sex IN (1, 2);";
            Value = KOC.Lodash.extend({
                NickName: null,
                QQ: null,
                Sex: null,
                Birthday: null,
                Constellation: null,
                Signature: null,
                User_ID: null
            }, Value);
            Value.NickName = Value.NickName ? Value.NickName.replace(/ /g, "").replace(/　/g, "") : null;
            if (!Value.Birthday || !(/^(\d{4})-(\d{2})-(\d{2})$/.test(Value.Birthday))) {
                Value.Birthday = null;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_AnchorApply: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `RealName` = :RealName" +
                ", `Sex` = :Sex" +
                " WHERE `User_ID` = :User_ID" +
                " AND :RealName IS NOT NULL" +
                " AND :Sex IN (1, 2);";
            Value = KOC.Lodash.extend({
                User_ID: null,
                RealName: null,
                Sex: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        //*******************************!!!!!!!改
        Update_ApplyMoney_LastDate: function (Conn, User_ID, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `ApplyMoney_LastDate` = NOW()" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Status` = 0;";
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, {User_ID: User_ID}, callback, this.CacheParm.Info(User_ID));
        },
        Update_IsAnchor: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `IsAnchor` = :IsAnchor_After" +
                " WHERE `User_ID` = :User_ID" +
                " AND `IsAnchor` = :IsAnchor_Before;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Status: null//true or false
            }, Value);
            if (Value.Status) {
                Value.IsAnchor_Before = 0;
                Value.IsAnchor_After = 1;
            } else {
                Value.IsAnchor_Before = 1;
                Value.IsAnchor_After = 0;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_IsFamily: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `IsFamily` = :IsFamily_After" +
                " WHERE `User_ID` = :User_ID" +
                " AND `IsFamily` = :IsFamily_Before;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Status: null//true-设置公会管理 or false -取消公会管理
            }, Value);
            if (Value.Status) {
                Value.IsFamily_Before = 0;
                Value.IsFamily_After = 1;
            } else {
                Value.IsFamily_Before = 1;
                Value.IsFamily_After = 0;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_IsAdmin: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `IsAdmin` = :IsAdmin_After" +
                " WHERE `User_ID` = :User_ID" +
                " AND `IsAdmin` = :IsAdmin_Before;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Status: null//true or false
            }, Value);
            if (!Value.Status) {
                Value.IsAdmin_Before = 0;
                Value.IsAdmin_After = 1;
            } else {
                Value.IsAdmin_Before = 1;
                Value.IsAdmin_After = 0;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Bank: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Coin` = CASE :Trade_Currency WHEN 1 THEN `Coin` + (:Trade_Flag * :Trade_Amt) ELSE `Coin` END" +
                ", `Coin_Today` = `Coin_Today` + CASE WHEN :Trade_Currency = 1 AND :Trade_Flag = -1 THEN :Trade_Amt ELSE 0 END" +
                ", `Coin_Week` = `Coin_Week` + CASE WHEN :Trade_Currency = 1 AND :Trade_Flag = -1 THEN :Trade_Amt ELSE 0 END" +
                ", `Coin_Month` = `Coin_Month` + CASE WHEN :Trade_Currency = 1 AND :Trade_Flag = -1 THEN :Trade_Amt ELSE 0 END" +
                ", `Coin_Year` = `Coin_Year` + CASE WHEN :Trade_Currency = 1 AND :Trade_Flag = -1 THEN :Trade_Amt ELSE 0 END" +
                ", `Coin_Total` = `Coin_Total` + CASE WHEN :Trade_Currency = 1 AND :Trade_Flag = -1 THEN :Trade_Amt ELSE 0 END" +
                ", `Beans` = CASE :Trade_Currency WHEN 2 THEN `Beans` + (:Trade_Flag * :Trade_Amt) ELSE `Beans` END" +
                ", `Beans_Today` = `Beans_Today` + CASE WHEN :Trade_Currency = 2 AND :Trade_Flag = 1 THEN :Trade_Amt ELSE 0 END" +
                ", `Beans_Week` = `Beans_Week` + CASE WHEN :Trade_Currency = 2 AND :Trade_Flag = 1 THEN :Trade_Amt ELSE 0 END" +
                ", `Beans_Month` = `Beans_Month` + CASE WHEN :Trade_Currency = 2 AND :Trade_Flag = 1 THEN :Trade_Amt ELSE 0 END" +
                ", `Beans_Year` = `Beans_Year` + CASE WHEN :Trade_Currency = 2 AND :Trade_Flag = 1 THEN :Trade_Amt ELSE 0 END" +
                ", `Beans_Total` = `Beans_Total` + CASE WHEN :Trade_Currency = 2 AND :Trade_Flag = 1 THEN :Trade_Amt ELSE 0 END" +
                " WHERE `User_ID` = :User_ID" +
                " AND CASE :Trade_Currency WHEN 1 THEN `Coin` + (:Trade_Flag * :Trade_Amt) ELSE `Coin` END >= 0" +
                " AND CASE :Trade_Currency WHEN 2 THEN `Beans` + (:Trade_Flag * :Trade_Amt) ELSE `Beans` END >= 0" +
                " AND :Trade_Currency IN (1, 2)" +
                " AND :Trade_Flag IN (-1, 1)" +
                " AND :Trade_Amt > 0" +
                " AND ROUND(:Trade_Amt) = :Trade_Amt;";
            Value = KOC.Lodash.extend({
                Trade_Currency: null,
                Trade_Flag: null,
                Trade_Amt: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Fans: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Fans` = `Fans` + :Num" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Fans` + :Num >= 0" +
                " AND :Num IN (1, -1);";
            Value = KOC.Lodash.extend({
                Num: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Attention: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Attention` = `Attention` + :Num" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Attention` + :Num >= 0" +
                " AND :Num IN (1, -1);";
            Value = KOC.Lodash.extend({
                Num: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_EXP: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `EXP` = `EXP` + :EXP" +
                " WHERE `User_ID` = :User_ID" +
                " AND :EXP > 0" +
                " AND ROUND(:EXP) = :EXP;";
            Value = KOC.Lodash.extend({
                EXP: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_VIP: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `VIP` = 1" +
                ", `VIP_Expire` = DATE_ADD(CASE WHEN `VIP_Expire` > NOW() THEN `VIP_Expire` ELSE NOW() END, INTERVAL :VIP_Value " + Value.VIP_Mode + ")" +
                " WHERE `User_ID` = :User_ID" +
                " AND :VIP_Value > 0" +
                " AND ROUND(:VIP_Value) = :VIP_Value;";
            Value = KOC.Lodash.extend({
                VIP_Mode: null,
                VIP_Value: null,
                User_ID: null
            }, Value);
            if (!KOC.Lodash.includes(["YEAR", "MONTH", "WEEK", "DAY"], Value.VIP_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:VIP_Mode"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Password: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Password` = :Password" +
                ", `PasswordKey` = ''" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                Password: null,
                User_ID: null
            }, Value);
            Value.Password = KOC.StringUtils.MD5(Value.Password);
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Login: function (Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Login_Count` = `Login_Count` + 1" +
                " ,`Login_Last_Date` = `Login_This_Date`" +
                " ,`Login_Last_IP` = `Login_This_IP`" +
                " ,`Login_This_Date` = NOW()" +
                " ,`Login_This_IP` = :Login_This_IP" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                Login_This_IP: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Mount: function (Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Mounts_ID` = :Mounts_ID " +
                " WHERE `User_ID` = :User_ID " +
                "AND :Mounts_ID IS NOT NULL;";
            Value = KOC.Lodash.extend({
                Mounts_ID: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_PomeloPresent: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Pomelo` = `Pomelo` - :Num" +
                ", `EXP` = `EXP` + (:EXP * :Num)" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Pomelo` - :Num >= 0" +
                " AND :Num > 0" +
                " AND ROUND(:Num) = :Num;";
            Value = KOC.Lodash.extend({
                Num: null,
                EXP: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_PomeloGet: function (Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Pomelo` = `Pomelo` + 1" +
                ", `Pomelo_Get_Num` = `Pomelo_Get_Num` + 1" +
                ", `Pomelo_Get_NumToday` = CASE IFNULL(DATEDIFF(`Pomelo_Get_Date`, NOW()), 1) WHEN 0 THEN `Pomelo_Get_NumToday` + 1 ELSE 1 END" +
                ", `Pomelo_Get_Date` = NOW()" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Pomelo` + 1 <= 99" +
                " AND :MAXToday > 0" +
                " AND (CASE IFNULL(DATEDIFF(`Pomelo_Get_Date`, NOW()), 1) WHEN 0 THEN `Pomelo_Get_NumToday` + 1 ELSE 1 END) <= :MAXToday;";
            Value = KOC.Lodash.extend({
                MAXToday: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Pomelo: function (Conn, User_ID, Num, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Pomelo` = CASE WHEN `Pomelo` + :Num < 0 THEN 0 ELSE CASE WHEN `Pomelo` + :Num > 99 THEN 99 ELSE `Pomelo` + :Num END END" +
                " WHERE `User_ID` = :User_ID" +
                " AND ROUND(:Num) = :Num;";
            Mysql_Helper.ExecuteNonQuery(Conn, sql, {
                User_ID: User_ID,
                Num: Num
            }, callback, this.CacheParm.Info(User_ID));
        },
        //*******************************!!!!!!!改
        Update_Phone: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Phone` = :Phone" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                Phone: null,
                User_ID: null
            }, Value);
            if (Value.Phone && !(/^1\d{10}$/).test(Value.Phone)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "手机号码不正确：" + Value.Phone
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_OAuthQQ: function (Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `OAuth_QQ_ID` = :OAuth_QQ_ID" +
                ", `OAuth_QQ_Token` = :OAuth_QQ_Token" +
                ", `OAuth_QQ_TokenCreate` = NOW()" +
                ", `OAuth_QQ_ExpiresIn` = :OAuth_QQ_ExpiresIn" +
                ", `OAuth_QQ_RefreshToken` = :OAuth_QQ_RefreshToken" +
                ", `Sex` = :Sex" +
                ", `Create_IP` = :Create_IP" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                OAuth_QQ_ID: null,
                OAuth_QQ_Token: null,
                OAuth_QQ_ExpiresIn: null,
                OAuth_QQ_RefreshToken: null,
                Sex: null,
                Create_IP: null
            }, Value);
            if (!Value.OAuth_QQ_ID || !Value.OAuth_QQ_Token || !(Value.OAuth_QQ_ExpiresIn > 0)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.Sex)) {
                Value.Sex = -1;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_OAuthWeibo: function (Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `OAuth_Weibo_ID` = :OAuth_Weibo_ID" +
                ", `OAuth_Weibo_Token` = :OAuth_Weibo_Token" +
                ", `OAuth_Weibo_TokenCreate` = NOW()" +
                ", `OAuth_Weibo_ExpiresIn` = :OAuth_Weibo_ExpiresIn" +
                ", `Sex` = :Sex" +
                ", `Create_IP` = :Create_IP" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                OAuth_Weibo_ID: null,
                OAuth_Weibo_Token: null,
                OAuth_Weibo_ExpiresIn: null,
                Sex: null,
                Create_IP: null
            }, Value);
            if (!Value.OAuth_Weibo_ID || !Value.OAuth_Weibo_Token || !(Value.OAuth_Weibo_ExpiresIn > 0)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.Sex)) {
                Value.Sex = -1;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_OAuthWeixin: function (Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `OAuth_Weixin_ID` = :OAuth_Weixin_ID" +
                ", `OAuth_Weixin_UNIONID` = :OAuth_Weixin_UNIONID" +
                ", `OAuth_Weixin_Token` = :OAuth_Weixin_Token" +
                ", `OAuth_Weixin_TokenCreate` = NOW()" +
                ", `OAuth_Weixin_ExpiresIn` = :OAuth_Weixin_ExpiresIn" +
                ", `OAuth_Weixin_RefreshToken` = :OAuth_Weixin_RefreshToken" +
                ", `Sex` = :Sex" +
                ", `Create_IP` = :Create_IP" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                OAuth_Weixin_ID: null,
                OAuth_Weixin_UNIONID: null,
                OAuth_Weixin_Token: null,
                OAuth_Weixin_ExpiresIn: null,
                OAuth_Weixin_RefreshToken: null,
                Sex: null,
                Create_IP: null
            }, Value);
            if (!Value.OAuth_Weixin_ID || !Value.OAuth_Weixin_Token || !(Value.OAuth_Weixin_ExpiresIn > 0)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.Sex)) {
                Value.Sex = -1;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Status: function (Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Status` = :Status" +
                " WHERE `User_ID` = :User_ID" +
                " AND :Status IN (0, 1);";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Status: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        //*******************************!!!!!!!改
        Update_InviteCount: function (User_ID, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Invite_Count` = CASE WHEN `Invite_Count` > 0 THEN `Invite_Count` + 1 ELSE 1 END" +
                " WHERE `User_ID` = :User_ID;";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, {
                User_ID: User_ID
            }, callback, this.CacheParm.Info(User_ID));
        },
        Update_IDCard: function (Conn, Value, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `IDCard` = :IDCard" +
                ", `IDCard_Status` = :IDCard_Status" +
                " WHERE `User_ID` = :User_ID" +
                " AND `IDCard_Status` <> :IDCard_Status" +
                " AND `IDCard_Status` != 0" +
                " AND :IDCard_Status >= 0;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                IDCard: null,
                IDCard_Status: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback, this.CacheParm.Info(User_ID));
        },
        Update_Charge: function (Conn, User_ID, callback) {
            var sql = "UPDATE `user_info`" +
                " SET `Charge_First` = 1" +
                ", `Charge_First_Award` = 1" +
                ", `Charge_First_Date` = IFNULL(`Charge_First_Date`, NOW())" +
                ", `Charge_Last_Date` = NOW()" +
                " WHERE `User_ID` = :User_ID";
            User_ID = KOC.StringUtils.ToIntPositive(User_ID);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, {
                User_ID: User_ID
            }, callback, this.CacheParm.Info(User_ID));
        },
      Update_Coin: function (Value, callback) {
        var sql = "UPDATE `user_info`" +
          " SET `Coin` = `Coin` + 5" +
          ", `Interface_Calls` = :Interface_Calls" +
          ", `Interface_Date` = NOW()" +
          " WHERE `User_ID` = :User_ID;";
        Value = KOC.Lodash.extend({
          User_ID: null,
          Interface_Calls:null
        }, Value);
        Mysql_Helper.ExecuteNonQuery(DBName, sql,Value, callback, this.CacheParm.Info(Value.User_ID));
      },
        Update_Scheduler: function (callback) {
            var sql = "UPDATE `user_info` LEFT JOIN `user_mounts`" +
                " ON `user_info`.`User_ID` = `user_mounts`.`User_ID`" +
                " AND `user_info`.`Mounts_ID` = `user_mounts`.`Mounts_ID`" +
                " SET `user_info`.`VIP` = CASE WHEN `user_info`.`VIP` = 1 AND `user_info`.`VIP_Expire` >= NOW() THEN 1 ELSE 0 END" +
                ", `user_info`.`Coin_Today` = 0" +
                ", `user_info`.`Coin_Week` = CASE DAYOFWEEK(NOW()) WHEN 2 THEN 0 ELSE `user_info`.`Coin_Week` END" + //每周一凌晨
                ", `user_info`.`Coin_Month` = CASE DAYOFMONTH(NOW()) WHEN 1 THEN 0 ELSE `user_info`.`Coin_Month` END" +
                ", `user_info`.`Coin_Year` = CASE DAYOFYEAR(NOW()) WHEN 1 THEN 0 ELSE `user_info`.`Coin_Year` END" +
                ", `user_info`.`Beans_Today` = 0" +
                ", `user_info`.`Beans_Week` = CASE DAYOFWEEK(NOW()) WHEN 2 THEN 0 ELSE `user_info`.`Beans_Week` END" + //每周一凌晨
                ", `user_info`.`Beans_Month` = CASE DAYOFMONTH(NOW()) WHEN 1 THEN 0 ELSE `user_info`.`Beans_Month` END" +
                ", `user_info`.`Beans_Year` = CASE DAYOFYEAR(NOW()) WHEN 1 THEN 0 ELSE `user_info`.`Beans_Year` END" +
                ", `user_info`.`Mounts_ID` = CASE WHEN `user_mounts`.`Mounts_ID` IS NOT NULL AND `user_mounts`.`Mounts_Expire` >= NOW() THEN `user_info`.`Mounts_ID` ELSE -1 END";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
        },
        CacheParm: {
            Info: function (User_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_info` WHERE `User_ID` = :User_ID LIMIT 1;",
                    Parm: {User_ID: KOC.StringUtils.ToIntPositive(User_ID)}
                };
            }
        }
    },
    //endregion
    //region User_Mobile:用户移动设备表
    User_Mobile: {
        Info: function (Mobile_ID, callback) {
            var cacheParm = this.CacheParm.Info(Mobile_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        Info_EquipmentCode: function (Equipment_Code, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT * FROM `user_mobile` WHERE `Equipment_Code` = :Equipment_Code LIMIT 1;", {
                Equipment_Code: Equipment_Code
            }, callback);
        },
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `user_mobile`" +
                " (`Equipment_Type`" +
                ", `Equipment_Code`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Equipment_Type" +
                ", :Equipment_Code" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Equipment_Type: null,
                Equipment_Code: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Update_Open: function (Value, callback) {
            var sql = "UPDATE `user_mobile`" +
                " SET `Equipment_Name`= :Equipment_Name" +
                " ,`Screen_Width`= :Screen_Width" +
                " ,`Screen_Height`= :Screen_Height" +
                " ,`OS_Version`= :OS_Version";
            if (KOC.StringUtils.ToInt(Value.Longitude) > 0 && KOC.StringUtils.ToInt(Value.Latitude) > 0) {
                sql += " ,`Longitude`= :Longitude" +
                    " ,`Latitude`= :Latitude" +
                    " ,`LocationDate` = NOW()";
            }
            sql += " ,`Open_Count`= `Open_Count` + 1" +
                " ,`Open_Last_Date` = NOW()" +
                " WHERE `Mobile_ID` = :Mobile_ID";
            Value = KOC.Lodash.extend({
                Equipment_Name: null,
                Screen_Width: null,
                Screen_Height: null,
                OS_Version: null,
                Longitude: null,
                Latitude: null,
                Mobile_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.Mobile_ID));
        },
        Update_UserID: function (Value, callback) {
            var sql = "UPDATE `user_mobile`" +
                " SET `User_ID` = :User_ID " +
                " WHERE `Mobile_ID` = :Mobile_ID;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Mobile_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.Mobile_ID));
        },
        CacheParm: {
            Info: function (Mobile_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_mobile` WHERE `Mobile_ID` = :Mobile_ID LIMIT 1;",
                    Parm: {Mobile_ID: KOC.StringUtils.ToIntPositive(Mobile_ID)}
                };
            }
        }
    },
    //endregion
    //region User_Mobile_APP:用户移动设备表
    User_Mobile_APP: {
        Info: function (Mobile_ID, APP_Type, callback) {
            var cacheParm = this.CacheParm.Info(Mobile_ID, APP_Type);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `user_mobile_app`" +
                " (`Mobile_ID`" +
                ", `APP_Type`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Mobile_ID" +
                ", :APP_Type" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Mobile_ID: null,
                APP_Type: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Update_AuthCode: function (Value, callback) {
            var sql = "UPDATE `user_mobile_app`" +
                " SET `Auth_Code`= :Auth_Code" +
                " WHERE `Mobile_ID` = :Mobile_ID" +
                " AND `APP_Type` = :APP_Type";
            Value = KOC.Lodash.extend({
                Mobile_ID: null,
                APP_Type: null
            }, Value);
            Value.Auth_Code = KOC.Uuid.v4();
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, function (retValue) {
                if (retValue.hasError) {
                    callback(retValue);
                    return;
                }
                if (retValue.returnObject !== 1) {
                    retValue.hasError = true;
                    retValue.message = "生成APP授权码出错，影响行(" + retValue.returnObject + ")";
                    callback(retValue);
                    return;
                }
                retValue.returnObject = Value.Auth_Code;
                callback(retValue);
            }, this.CacheParm.Info(Value.Mobile_ID, Value.APP_Type));
        },
        Update_Open: function (Value, callback) {
            var sql = "UPDATE `User_Mobile_APP`" +
                " SET `APP_Version`= :APP_Version" +
                " ,`APP_VersionCode`= :APP_VersionCode" +
                " ,`Open_Count`= `Open_Count` + 1" +
                " ,`Open_Last_Date` = NOW()" +
                " WHERE `Mobile_ID` = :Mobile_ID" +
                " AND `APP_Type` = :APP_Type";
            Value = KOC.Lodash.extend({
                APP_Version: null,
                APP_VersionCode: null,
                Mobile_ID: null,
                APP_Type: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.Mobile_ID, Value.APP_Type));
        },
        CacheParm: {
            Info: function (Mobile_ID, APP_Type) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_mobile_app` WHERE `Mobile_ID` = :Mobile_ID AND `APP_Type` = :APP_Type LIMIT 1;",
                    Parm: {
                        Mobile_ID: KOC.StringUtils.ToIntPositive(Mobile_ID),
                        APP_Type: KOC.StringUtils.ToIntPositive(APP_Type)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Anchor:艺人信息表
    User_Anchor: {
        Info: function (User_ID, callback) {
            var cacheParm = this.CacheParm.Info(User_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    var _LevelInfo = CommonUtils.Anchor.Level.fnLevelInfo(retValue.returnObject.EXP);
                    retValue.returnObject.Level = _LevelInfo.Level;
                    retValue.returnObject.Level_Name = _LevelInfo.Level_Name;
                    retValue.returnObject.Level_Next = _LevelInfo.Level_Next;
                    retValue.returnObject.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    retValue.returnObject.EXP_Next = _LevelInfo.EXP_Next;
                    retValue.returnObject.EXP_Difference = _LevelInfo.Difference;
                }
                callback(retValue);
            });
        },
        Info_RoomName: function (RoomName, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT * FROM `user_anchor` WHERE `RoomName` = :RoomName LIMIT 1;", {
                RoomName: RoomName
            }, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    var _LevelInfo = CommonUtils.Anchor.Level.fnLevelInfo(retValue.returnObject.EXP);
                    retValue.returnObject.Level = _LevelInfo.Level;
                    retValue.returnObject.Level_Name = _LevelInfo.Level_Name;
                    retValue.returnObject.Level_Next = _LevelInfo.Level_Next;
                    retValue.returnObject.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    retValue.returnObject.EXP_Next = _LevelInfo.EXP_Next;
                    retValue.returnObject.EXP_Difference = _LevelInfo.Difference;
                }
                callback(retValue);
            });
        },
        Info_IDCard: function (IDCard, callback) {
            Mysql_Helper.ExecuteRow(DBName, "SELECT `User_ID` FROM `user_anchor` WHERE `IDCard` = :IDCard LIMIT 1;", {IDCard: IDCard}, callback);
        },
        //***************临时方法
        Info_All: function (callback) {
            Mysql_Helper.ExecuteTable(DBName, "SELECT `User_ID` FROM `user_anchor`", null, function (retValue) {
                if (retValue.hasError) {
                    callback(retValue);
                    return;
                }
                callback(retValue);
            });
        },
        List_Hot_J: function (Value, callback) {
            Value = KOC.Lodash.extend({
                Cache: null,
                Limit: null,
                UserStatus: 0,
                AnchorFamilyID: null,
                AnchorLive: null,
                AnchorLiveStreamStatus: null,
                AnchorStatus: 0,
                Order: null
            }, Value);
            Value.Limit = KOC.StringUtils.ToIntPositive(Value.Limit);
            Value.UserStatus = KOC.StringUtils.ToInt(Value.UserStatus, -1);
            Value.AnchorFamilyID = KOC.StringUtils.ToIntPositive(Value.AnchorFamilyID);
            Value.AnchorLive = KOC.StringUtils.ToInt(Value.AnchorLive, -1);
            Value.AnchorLiveStreamStatus = KOC.StringUtils.ToInt(Value.AnchorLiveStreamStatus, -1);
            Value.AnchorStatus = KOC.StringUtils.ToInt(Value.AnchorStatus, -1);
            var sql = "";
            if (Value.UserStatus >= 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_info`.`Status` = :UserStatus", "AND");
            }
            if (Value.AnchorFamilyID) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_anchor`.`Family_ID` = :AnchorFamilyID", "AND");
            }
            if (Value.AnchorLive >= 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_anchor`.`Live` = :AnchorLive", "AND");
            }
            if (Value.AnchorLiveStreamStatus >= 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_anchor`.`Live_Stream_Status` = :AnchorLiveStreamStatus", "AND");
            }
            if (Value.AnchorStatus >= 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_anchor`.`Status` = :AnchorStatus", "AND");
            }
            switch (Value.Order) {
                case "New":
                    Value.Order = "`Live` DESC, `Anchor_Create_Date` DESC";
                    break;
                case "HotValuePrevious":
                    Value.Order = "`Live` DESC, `Hot_Value_Previous` DESC";
                    break;
                default:
                    Value.Order = "`Live` DESC, `Hot_Value` DESC, `Hot_Value_Previous` DESC";
                    break;
            }
            sql = "SELECT `user_info`.`User_ID`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`Signature`" +
                ", `user_info`.`Sex`" +
                ", `user_info`.`Birthday`" +
                ", `user_info`.`Constellation`" +
                ", `user_info`.`City`" +
                ", `user_info`.`Province`" +
                ", `user_info`.`EXP`" +
                ", `user_info`.`VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`Coin`" +
                ", `user_info`.`Coin_Today`" +
                ", `user_info`.`Coin_Week`" +
                ", `user_info`.`Coin_Month`" +
                ", `user_info`.`Coin_Year`" +
                ", `user_info`.`Coin_Total`" +
                ", `user_info`.`Beans`" +
                ", `user_info`.`Beans_Today`" +
                ", `user_info`.`Beans_Week`" +
                ", `user_info`.`Beans_Month`" +
                ", `user_info`.`Beans_Year`" +
                ", `user_info`.`Beans_Total`" +
                ", `user_info`.`Pomelo`" +
                ", `user_info`.`Pomelo_Get_Num`" +
                ", `user_info`.`Pomelo_Get_NumToday`" +
                ", `user_info`.`Pomelo_Get_Date`" +
                ", `user_info`.`Fans`" +
                ", `user_info`.`Attention`" +
                ", `user_info`.`Status`" +
                ", `user_anchor`.`RoomName`" +
                ", `user_anchor`.`Family_ID`" +
                ", `user_anchor`.`RoomWelcome`" +
                ", `user_anchor`.`RoomTemplate`" +
                ", `user_anchor`.`RoomTitle`" +
                ", `user_anchor`.`RoomNotice`" +
                ", `user_anchor`.`Account_City`" +
                ", `user_anchor`.`Account_Province`" +
                ", `user_anchor`.`Tags`" +
                ", `user_anchor`.`EXP` AS `Anchor_EXP`" +
                ", `user_anchor`.`Pomelo` AS `Anchor_Pomelo`" +
                ", `user_anchor`.`Pomelo_Today` AS `Anchor_Pomelo_Today`" +
                ", `user_anchor`.`Pomelo_Week` AS `Anchor_Pomelo_Week`" +
                ", `user_anchor`.`Pomelo_Month` AS `Anchor_Pomelo_Month`" +
                ", `user_anchor`.`Pomelo_Year` AS `Anchor_Pomelo_Year`" +
                ", `user_anchor`.`Live`" +
                ", `user_anchor`.`Live_FirstDate`" +
                ", `user_anchor`.`Live_IsMobile`" +
                ", `user_anchor`.`Live_Mode`" +
                ", `user_anchor`.`Live_StartTime`" +
                ", CASE `user_anchor`.`Live` WHEN 1 THEN `user_anchor`.`Live_Stream_Status` ELSE 0 END AS `Live_Stream_Status`" +
                ", `user_anchor`.`IsWeekStar`" +
                ", `user_anchor`.`IsRecommend`" +
                ", `user_anchor`.`ProtectDue_Date`" +
                ", `user_anchor`.`Create_Date` AS `Anchor_Create_Date`" +
                ", `user_anchor`.`Status` AS `Anchor_Status`" +
                ", IFNULL(`family_info`.`Family_Name`, '') AS `Family_Name`" +
                ", IFNULL(`user_anchor_hot`.`Value_Previous`, 0) AS `Hot_Value_Previous`" +
                ", IFNULL(`user_anchor_hot`.`Value`, 0) AS `Hot_Value`" +
                " FROM `user_anchor`" +
                " JOIN `user_info`" +
                " ON `user_anchor`.`User_ID` = `user_info`.`User_ID`" +
                " LEFT JOIN `user_anchor_hot`" +
                " ON `user_anchor`.`User_ID` = `user_anchor_hot`.`User_ID`" +
                " LEFT JOIN `family_info`" +
                " ON `user_anchor`.`Family_ID` = `family_info`.`Family_ID`"
                + (sql ? " WHERE " + sql : "")
                + " ORDER BY " + Value.Order
                + " LIMIT " + (Value.Limit || "500");
            Mysql_Helper.ExecuteTable(DBName, sql, Value, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                for (var i = 0; i < retValue.returnObject.length; i++) {
                    var _ThisValue = retValue.returnObject[i];
                    if (_ThisValue.VIP && _ThisValue.VIP_Expire && KOC.Moment().isAfter(KOC.Moment(_ThisValue.VIP_Expire))) {
                        _ThisValue.VIP = 0;
                    }
                    if (_ThisValue.VIP && _ThisValue.VIP_Expire) {
                        _ThisValue.VIP_ExpireDay = KOC.Moment(_ThisValue.VIP_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(_ThisValue.VIP_Expire).diff(KOC.Moment(), "days");
                    }
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(_ThisValue.EXP);
                    _ThisValue.Level = _LevelInfo.Level;
                    _ThisValue.Level_Name = _LevelInfo.Level_Name;
                    _ThisValue.Level_Next = _LevelInfo.Level_Next;
                    _ThisValue.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    _ThisValue.EXP_Next = _LevelInfo.EXP_Next;
                    _ThisValue.EXP_Difference = _LevelInfo.Difference;
                    _LevelInfo = CommonUtils.Anchor.Level.fnLevelInfo(_ThisValue.Anchor_EXP);
                    _ThisValue.Anchor_Level = _LevelInfo.Level;
                    _ThisValue.Anchor_Level_Name = _LevelInfo.Level_Name;
                    _ThisValue.Anchor_Level_Next = _LevelInfo.Level_Next;
                    _ThisValue.Anchor_Level_Next_Name = _LevelInfo.Level_Next_Name;
                    _ThisValue.Anchor_EXP_Next = _LevelInfo.EXP_Next;
                    _ThisValue.Anchor_EXP_Difference = _LevelInfo.Difference;
                    _ThisValue.Hot_Value = _ThisValue.Live ? _ThisValue.Hot_Value : 0;
                    //临时加Anchor_HotValue
                    _ThisValue.Anchor_HotValue = _ThisValue.Hot_Value;
                }
                callback(retValue);
            }, Value.Cache);
        },
        List_ChannelStrategy: function (callback) {
            var cacheParm = this.CacheParm.List_ChannelStrategy();
            Mysql_Helper.ExecuteTableCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        List_ChannelStrategySpecific: function (List, callback) {
            var sql = "SELECT 'Specific' AS `Type`" +
                ", `User_ID`" +
                ", `Create_Date`" +
                " FROM `user_anchor`" +
                " WHERE `Live` = 1" +
                " AND `Live_Stream_Status` = 1" +
                " AND `User_ID` IN (:User_ID_List)";
            Mysql_Helper.ExecuteTableCache(DBName, sql, {
                User_ID_List: List
            }, callback);
        },

        List_Search_J: function (Value, callback) {
            Value = KOC.Lodash.extend({
                Cache: null,
                Limit: null,
                FuzzyQuery: null,
                UserStatus: 0,
                AnchorLive: null,
                AnchorLiveStreamStatus: null,
                AnchorStatus: 0,
                Order: null
            }, Value);
            Value.Limit = KOC.StringUtils.ToIntPositive(Value.Limit);
            Value.UserStatus = KOC.StringUtils.ToInt(Value.UserStatus, -1);
            Value.AnchorFamilyID = KOC.StringUtils.ToIntPositive(Value.AnchorFamilyID);
            Value.AnchorLive = KOC.StringUtils.ToInt(Value.AnchorLive, -1);
            Value.AnchorLiveStreamStatus = KOC.StringUtils.ToInt(Value.AnchorLiveStreamStatus, -1);
            Value.AnchorStatus = KOC.StringUtils.ToInt(Value.AnchorStatus, -1);
            var sql = "";
            if (Value.UserStatus >= 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_info`.`Status` = :UserStatus", "AND");
            }
            if (Value.AnchorLive >= 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_anchor`.`Live` = :AnchorLive", "AND");
            }
            if (Value.AnchorLiveStreamStatus >= 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_anchor`.`Live_Stream_Status` = :AnchorLiveStreamStatus", "AND");
            }
            if (Value.AnchorStatus >= 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_anchor`.`Status` = :AnchorStatus", "AND");
            }
            Value.FuzzyQuery = KOC.StringUtils.ToString(Value.FuzzyQuery);
            if (Value.FuzzyQuery.trim()) {
                Value.FuzzyQueryLike = "%" + Value.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(Value.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`User_ID` = :FuzzyQuery", "OR");
                }
                sql = Mysql_Helper.AddToWhereSQL(sql, _Condition_FuzzyQuery, "AND");
            }
            switch (Value.Order) {
                case "Level":
                    Value.Order = "`Live` DESC, `Anchor_EXP` DESC";
                    break;
                case "HotValuePrevious":
                    Value.Order = "`Live` DESC, `Hot_Value_Previous` DESC";
                    break;
                case "BeansToday":
                    Value.Order = "`Live` DESC, `Beans_Today` DESC";
                    break;
                case "IsRecommend":
                    Value.Order = "`Live` DESC, `IsRecommend` DESC";
                    break;
                default:
                    Value.Order = "`Live` DESC, `Hot_Value` DESC, `Anchor_EXP` DESC";
                    break;
            }
            sql = "SELECT `user_anchor`.`User_ID`" +
                ", `user_anchor`.`Family_Commission`" +
                ", `user_anchor`.`RoomName`" +
                ", `user_anchor`.`RoomWelcome`" +
                ", `user_anchor`.`RoomTemplate`" +
                ", `user_anchor`.`RoomTitle`" +
                ", `user_anchor`.`RoomNotice`" +
                ", `user_anchor`.`Family_ID`" +
                ", `user_anchor`.`Tags`" +
                ", `user_anchor`.`EXP` AS `Anchor_EXP`" +
                ", `user_anchor`.`HotValue_Ranking`" +
                ", `user_anchor`.`HotValue`" +
                ", `user_anchor`.`ActivityNum`" +
                ", `user_anchor`.`Pomelo` AS `Anchor_Pomelo`" +
                ", `user_anchor`.`Pomelo_Today` AS `Anchor_Pomelo_Today`" +
                ", `user_anchor`.`Pomelo_Week` AS `Anchor_Pomelo_Week`" +
                ", `user_anchor`.`Pomelo_Month` AS `Anchor_Pomelo_Month`" +
                ", `user_anchor`.`Pomelo_Year` AS `Anchor_Pomelo_Year`" +
                ", `user_anchor`.`Live`" +
                ", `user_anchor`.`Live_FirstDate`" +
                ", `user_anchor`.`Live_IsMobile`" +
                ", `user_anchor`.`Live_Mode`" +
                ", `user_anchor`.`Live_Order_No`" +
                ", `user_anchor`.`Live_StartTime`" +
                ", `user_anchor`.`Live_Duration_Total`" +
                ", `user_anchor`.`Live_Stream_LastDate`" +
                ", CASE `user_anchor`.`Live` WHEN 1 THEN `user_anchor`.`Live_Stream_Status` ELSE 0 END AS `Live_Stream_Status`" +
                ", `user_anchor`.`Network`" +
                ", `user_anchor`.`IsWeekStar`" +
                ", `user_anchor`.`IsRecommend`" +
                ", `user_anchor`.`ProtectDue_Date`" +
                ", `user_anchor`.`Rating`" +
                ", `user_anchor`.`Rating_Salary`" +
                ", `user_anchor`.`Rating_Task_Beans`" +
                ", `user_anchor`.`Rating_Task_LiveDay`" +
                ", `user_anchor`.`Rating_Task_LiveDuration`" +
                ", `user_anchor`.`Rating_Date`" +
                ", `user_anchor`.`Score`" +
                ", `user_anchor`.`Score_Last`" +
                ", `user_anchor`.`Score_Coin`" +
                ", `user_anchor`.`Score_Coin_Last`" +
                ", `user_anchor`.`Score_SignUp`" +
                ", `user_anchor`.`Score_SignUp_Last`" +
                ", `user_anchor`.`Integral`" +
                ", `user_anchor`.`Integral_Month`" +
                ", `user_anchor`.`Integral_Month_Last`" +
                ", `user_anchor`.`Integral_Week`" +
                ", `user_anchor`.`Integral_Week_Last`" +
                ", `user_anchor`.`Integral_Date`" +
                ", `user_anchor`.`Approve_Admin_ID`" +
                ", `user_anchor`.`Approve_RealName`" +
                ", `user_anchor`.`Approve_Date`" +
                ", `user_anchor`.`Duty_Admin_ID`" +
                ", `user_anchor`.`Duty_RealName`" +
                ", `user_anchor`.`Cover_Admin_ID`" +
                ", `user_anchor`.`Cover_RealName`" +
                ", `user_anchor`.`Cover_Date`" +
                ", `user_anchor`.`List_Order`" +
                ", `user_anchor`.`Create_Date`" +
                ", `user_anchor`.`Create_IP`" +
                ", `user_anchor`.`Status` AS `Anchor_Status`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`IDCard`" +
                ", `user_info`.`IDCard_Status`" +
                ", `user_info`.`Email`" +
                ", `user_info`.`Phone`" +
                ", `user_info`.`QQ`" +
                ", `user_info`.`Sex`" +
                ", `user_info`.`EXP`" +
                ", `user_info`.`Fans`" +
                ", `user_info`.`Attention`" +
                ", `user_info`.`IsFamily`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`Beans`" +
                ", `user_info`.`Beans_Today`" +
                ", `user_info`.`Beans_Week`" +
                ", `user_info`.`Beans_Month`" +
                ", `user_info`.`Beans_Year`" +
                ", `user_info`.`Beans_Total`" +
                ", `user_info`.`ApplyMoney_LastDate`" +
                ", `user_info`.`Status`" +
                ", IFNULL(`family_info`.`Family_Name`, '') AS `Family_Name`" +
                ", IFNULL(`family_info`.`User_ID`, -1) AS `Family_UserID`" +
                ", IFNULL(`user_anchor_hot`.`Value_Previous`, 0) AS `Hot_Value_Previous`" +
                ", IFNULL(`user_anchor_hot`.`Value`, 0) AS `Hot_Value`" +
                " FROM `user_anchor` JOIN `user_info`" +
                " ON `user_anchor`.`User_ID` = `user_info`.`User_ID`" +
                " LEFT JOIN `user_anchor_hot`" +
                " ON `user_anchor`.`User_ID` = `user_anchor_hot`.`User_ID`" +
                " LEFT JOIN `family_info`" +
                " ON `user_anchor`.`Family_ID` = `family_info`.`Family_ID`" +
                (sql ? " WHERE " + sql : "") +
                " ORDER BY " + Value.Order +
                " LIMIT " + (Value.Limit || "50");
            Mysql_Helper.ExecuteTable(DBName, sql, Value, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "User_ID",
                        "Family_Commission",
                        "RoomName",
                        "RoomWelcome",
                        "RoomTemplate",
                        "RoomTitle",
                        "RoomNotice",
                        "Family_ID",
                        "Tags",
                        "Anchor_EXP",
                        "HotValue_Ranking",
                        "HotValue",
                        "ActivityNum",
                        "Anchor_Pomelo",
                        "Anchor_Pomelo_Today",
                        "Anchor_Pomelo_Week",
                        "Anchor_Pomelo_Month",
                        "Anchor_Pomelo_Year",
                        "Live",
                        "Live_FirstDate",
                        "Live_IsMobile",
                        "Live_Mode",
                        "Live_Order_No",
                        "Live_StartTime",
                        "Live_Duration_Total",
                        "Live_Stream_LastDate",
                        "Live_Stream_Status",
                        "Network",
                        "IsWeekStar",
                        "IsRecommend",
                        "ProtectDue_Date",
                        "Rating",
                        "Rating_Salary",
                        "Rating_Task_Beans",
                        "Rating_Task_LiveDay",
                        "Rating_Task_LiveDuration",
                        "Rating_Date",
                        "Score",
                        "Score_Last",
                        "Score_Coin",
                        "Score_Coin_Last",
                        "Score_SignUp",
                        "Score_SignUp_Last",
                        "Integral",
                        "Integral_Month",
                        "Integral_Month_Last",
                        "Integral_Week",
                        "Integral_Week_Last",
                        "Integral_Date",
                        "Approve_Admin_ID",
                        "Approve_RealName",
                        "Approve_Date",
                        "Duty_Admin_ID",
                        "Duty_RealName",
                        "Cover_Admin_ID",
                        "Cover_RealName",
                        "Cover_Date",
                        "List_Order",
                        "Create_Date",
                        "Create_IP",
                        "Anchor_Status",
                        "NickName",
                        "RealName",
                        "Signature",
                        "IDCard",
                        "IDCard_Status",
                        "Email",
                        "Phone",
                        "QQ",
                        "Sex",
                        "EXP",
                        "Fans",
                        "Attention",
                        "IsFamily",
                        "IsAnchor",
                        "Beans",
                        "Beans_Today",
                        "Beans_Week",
                        "Beans_Month",
                        "Beans_Year",
                        "Beans_Total",
                        "ApplyMoney_LastDate ",
                        "Status",
                        "Family_Name",
                        "Family_UserID",
                        "Hot_Value_Previous",
                        "Hot_Value"
                    ]);
                    ThisValue.RealName = KOC.StringUtils.Cover(ThisValue.RealName, "Name");
                    ThisValue.IDCard = KOC.StringUtils.Cover(ThisValue.IDCard, "IDCard");
                    ThisValue.Email = KOC.StringUtils.Cover(ThisValue.Email, "Email");
                    ThisValue.Phone = KOC.StringUtils.Cover(ThisValue.Phone, "Phone");
                    ThisValue.QQ = KOC.StringUtils.Cover(ThisValue.QQ, "QQ");
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(ThisValue.EXP);
                    ThisValue.Level = _LevelInfo.Level;
                    ThisValue.Level_Name = _LevelInfo.Level_Name;
                    ThisValue.Level_Next = _LevelInfo.Level_Next;
                    ThisValue.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    ThisValue.EXP_Next = _LevelInfo.EXP_Next;
                    ThisValue.EXP_Difference = _LevelInfo.Difference;
                    var _AnchorLevelInfo = CommonUtils.Anchor.Level.fnLevelInfo(ThisValue.Anchor_EXP);
                    ThisValue.Anchor_Level = _AnchorLevelInfo.Level;
                    ThisValue.Anchor_Level_Name = _AnchorLevelInfo.Level_Name;
                    ThisValue.Anchor_Level_Next = _AnchorLevelInfo.Level_Next;
                    ThisValue.Anchor_Level_Next_Name = _AnchorLevelInfo.Level_Next_Name;
                    ThisValue.Anchor_EXP_Next = _AnchorLevelInfo.EXP_Next;
                    ThisValue.Anchor_EXP_Difference = _AnchorLevelInfo.Difference;
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            }, Value.Cache);
        },
        //*******************************!!!!!!!改
        List_Live: function (callback) {
            var sql = "SELECT `User_ID` FROM `user_anchor` WHERE `Live` = 1;";
            Mysql_Helper.ExecuteTable(DBName, sql, null, function (retValue) {
                if (retValue.hasError) {
                    callback(retValue);
                    return;
                }
                callback(retValue);
            });
        },
        //*******************************!!!!!!!改
        Info_Live_Day: function (User_ID, callback) {
            var sql = "SELECT SUM(`Duration`) as `Duration`" +
                ", SUM(`Coin`) AS `Coin`" +
                ", SUM(`Gift_Beans_Anchor`) AS `Beans_Anchor`" +
                ", `Create_Date` " +
                " FROM `order_live`" +
                " WHERE TO_DAYS(`Create_Date`) = TO_DAYS(NOW())" +
                " AND `User_ID`= :User_ID";
            Mysql_Helper.ExecuteRow(DBName, sql, {User_ID: User_ID}, callback);
        },
        //*******************************!!!!!!!改
        Info_Duration_Efftive: function (User_ID, callback) {
            var sql = "SELECT " +
                " COUNT(`order_live`.`Order_No`) AS `Live_Count`" +
                ", SUM(TIMESTAMPDIFF(MINUTE" +
                ", CASE WHEN DATEDIFF(`order_live`.`Create_Date`, CURDATE()) = 0" +
                " THEN CASE WHEN `order_live`.`Create_Date` < DATE_ADD(CURDATE(), INTERVAL 8 HOUR)" +
                " THEN DATE_ADD(CURDATE(), INTERVAL 8 HOUR) ELSE `order_live`.`Create_Date` END" +
                " ELSE DATE_ADD(CURDATE(), INTERVAL 8 HOUR) END" +
                ", IFNULL(CASE WHEN `order_live`.`End_Date` < DATE_ADD(CURDATE(), INTERVAL 8 HOUR)" +
                " THEN DATE_ADD(CURDATE(), INTERVAL 8 HOUR)" +
                " ELSE `order_live`.`End_Date` END" +
                ", DATE_ADD(CURDATE(), INTERVAL 1 DAY)))) AS `Live_Duration_Efftive`" +
                " FROM (SELECT * FROM `order_live` WHERE `User_ID` = :User_ID AND `Status` = 0) AS `order_live`" +
                " WHERE DATEDIFF(`order_live`.`Create_Date`, CURDATE()) = 0" +
                " OR DATEDIFF(`order_live`.`End_Date`, CURDATE()) = 0";
            Mysql_Helper.ExecuteRow(DBName, sql, {User_ID: User_ID}, callback);
        },
        //*******************************!!!!!!!改
        User_Anchor_Cover: function (User_ID, callback) {
            var sql = "SELECT * FROM `user_anchor_cover` WHERE `User_ID` = :User_ID LIMIT 1;";
            Mysql_Helper.ExecuteRow(DBName, sql, {User_ID: User_ID}, callback);
        },

        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_anchor`" +
                " (`User_ID`" +
                ", `Family_ID`" +
                ", `Tags`" +
                ", `Network`" +
                ", `Account_RealName`" +
                ", `Account_CardNo`" +
                ", `Account_BankName`" +
                ", `Account_BankFullName`" +
                ", `Account_Province`" +
                ", `Account_City`" +
                ", `QQ`" +
                ", `Phone`" +
                ", `Email`" +
                ", `IDCard`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:User_ID" +
                ", :Family_ID" +
                ", :Tags" +
                ", :Network" +
                ", :Account_RealName" +
                ", :Account_CardNo" +
                ", :Account_BankName" +
                ", :Account_BankFullName" +
                ", :Account_Province" +
                ", :Account_City" +
                ", :QQ" +
                ", :Phone" +
                ", :Email" +
                ", :IDCard" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Family_ID: null,
                Tags: null,
                Network: null,
                Account_RealName: null,
                Account_CardNo: null,
                Account_BankName: null,
                Account_BankFullName: null,
                Account_Province: null,
                Account_City: null,
                IDCard: null,//新方法将身份证写入user_info中 此处需删除
                QQ: null,
                Phone: null,
                Email: null,
                User_ID: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update: function (Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `RoomName` = IFNULL(:RoomName, `RoomName`)" +
                ", `RoomWelcome` = IFNULL(:RoomWelcome, `RoomWelcome`)" +
                ", `RoomTemplate` = IFNULL(:RoomTemplate, `RoomTemplate`)" +
                ", `RoomTitle` = IFNULL(:RoomTitle, `RoomTitle`)" +
                ", `RoomNotice` = IFNULL(:RoomNotice, `RoomNotice`)" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                RoomName: null,
                RoomWelcome: null,
                RoomTemplate: null,
                RoomTitle: null,
                RoomNotice: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Pomelo: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Pomelo` = `Pomelo` + :Num" +
                ", `Pomelo_Today` = `Pomelo_Today` + :Num" +
                ", `Pomelo_Week` = `Pomelo_Week` + :Num" +
                ", `Pomelo_Month` = `Pomelo_Month` + :Num" +
                ", `Pomelo_Year` = `Pomelo_Year` + :Num" +
                ", `EXP` = `EXP` + (:EXP * :Num)" +
                " WHERE `User_ID` = :User_ID" +
                " AND :Num > 0" +
                " AND ROUND(:Num) = :Num" +
                " AND :EXP >= 0" +
                " AND ROUND(:EXP) = :EXP;";
            Value = KOC.Lodash.extend({
                Num: null,
                EXP: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_EXP: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `EXP` = `EXP` + :EXP" +
                " WHERE `User_ID` = :User_ID" +
                " AND :EXP > 0" +
                " AND ROUND(:EXP) = :EXP;";
            Value = KOC.Lodash.extend({
                EXP: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Live: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Live` = 1" +
                ", `Live_FirstDate` = IFNULL(`Live_FirstDate`, NOW())" +
                ", `Live_IsMobile` = :Live_IsMobile" +
                ", `Live_Mode` = :Live_Mode" +
                ", `Live_Order_No` = :Live_Order_No" +
                ", `Live_StartTime` = NOW()" +
                ", `RoomTitle` = IFNULL(:RoomTitle, `RoomTitle`)" +
                ", `RoomNotice` = IFNULL(:RoomNotice, `RoomNotice`)" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Live` = 0" +
                " AND :Live_Order_No IS NOT NULL";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Live_IsMobile: null,
                Live_Mode: null,
                Live_Order_No: null,
                RoomTitle: null,
                RoomNotice: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_LiveEnd: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor` JOIN `order_live`" +
                " ON `user_anchor`.`Live_Order_No` = `order_live`.`Order_No`" +
                " SET `user_anchor`.`Live` = 0" +
                ", `user_anchor`.`Live_Duration_Total` = `user_anchor`.`Live_Duration_Total` + `order_live`.`Duration`" +
                " WHERE `user_anchor`.`User_ID` = :User_ID" +
                " AND `user_anchor`.`Live` = 1" +
                " AND `order_live`.`Status` = 0;";
            Value = KOC.Lodash.extend({
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_LiveStream: function (Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Live_Stream_Status` = :Live_Stream_Status" +
                " ,`Live_Stream_LastDate` = NOW()" +
                " WHERE `User_ID` = :User_ID" +
                " AND :Live_Stream_Status IN (0, 1)" +
                " AND `Status` = 0;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Live_Stream_Status: null
            }, Value);
            Value.Live_Stream_Status = KOC.StringUtils.ToInt(Value.Live_Stream_Status, -1);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_FamilyID: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Family_ID` = :Family_ID" +
                " WHERE `User_ID` = :User_ID" +
                " AND Status < 2;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Family_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_HotValueForNext: function (callback) {
            var sql = "UPDATE `user_anchor` LEFT JOIN `user_anchor_hot`" +
                " ON `user_anchor`.`User_ID` = `user_anchor_hot`.`User_ID`" +
                " SET `user_anchor`.`HotValue` = IFNULL(`user_anchor_hot`.`Value_Previous`, 0)" +
                ", `user_anchor`.`HotValue_Ranking` = `user_anchor_hot`.`Value_Ranking_Previous`;";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
        },
        //*******************************!!!!!!!改
        Update_ListOrder: function (Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `List_Order` = CASE WHEN :List_Order IS NULL THEN `List_Order` ELSE :List_Order END" +
                ", `Tags` = CASE WHEN :Tags IS NULL THEN `Tags` ELSE :Tags END" +
                ", `IDCard` = CASE WHEN :IDCard IS NULL THEN `IDCard` ELSE :IDCard END" +
                ", `Phone` = CASE WHEN :Phone IS NULL THEN `Phone` ELSE :Phone END" +
                ", `Account_BankName` = CASE WHEN :Account_BankName IS NULL THEN `Account_BankName` ELSE :Account_BankName END" +
                ", `Account_BankFullName` = CASE WHEN :Account_BankFullName IS NULL THEN `Account_BankFullName` ELSE :Account_BankFullName END" +
                ", `Account_Province` = CASE WHEN :Account_Province IS NULL THEN `Account_Province` ELSE :Account_Province END" +
                ", `Account_City` = CASE WHEN :Account_City IS NULL THEN `Account_City` ELSE :Account_City END" +
                ", `Account_RealName` = CASE WHEN :Account_RealName IS NULL THEN `Account_RealName` ELSE :Account_RealName END" +
                ", `Account_CardNo` = CASE WHEN :Account_CardNo IS NULL THEN `Account_CardNo` ELSE :Account_CardNo END" +
                ", `IsRecommend` = :IsRecommend" +
                " WHERE `User_ID` = :User_ID " +
                " AND Status = 0;";
            Value = KOC.Lodash.extend({
                List_Order: null,
                Tags: null,
                Phone: null,
                IDCard: null,
                Account_BankName: null,
                Account_BankFullName: null,
                Account_Province: null,
                Account_City: null,
                Account_RealName: null,
                Account_CardNo: null,
                User_ID: null,
                IsRecommend: null
            }, Value);
            if (Value.Phone && !(/^1\d{10}$/).test(Value.Phone)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "手机号码不正确：" + Value.Phone
                }));
                return;
            }
            if (Value.List_Order && Value.List_Order < 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误：List_Order"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        //*******************************!!!!!!!改
        Update_Apply: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Tags` = :Tags" +
                ", `Family_ID` = :Family_ID" +
                ", `Network` = :Network" +
                ", `Account_RealName` = :Account_RealName" +
                ", `Account_CardNo` = :Account_CardNo" +
                ", `Account_BankName` = :Account_BankName" +
                ", `Account_BankFullName` = :Account_BankFullName" +
                ", `Account_Province` = :Account_Province" +
                ", `Account_City` = :Account_City" +
                ", `IDCard` = :IDCard" +
                ", `QQ` = :QQ" +
                ", `Phone` = :Phone" +
                ", `Email` = :Email" +
                ", `Status` = 2" +
                ", `Create_IP` = :Create_IP" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Status` = 3;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Family_ID: null,
                Tags: null,
                Network: null,
                Account_RealName: null,
                Account_CardNo: null,
                Account_BankName: null,
                Account_BankFullName: null,
                Account_Province: null,
                Account_City: null,
                IDCard: null,////新方法将身份证写入user_info中 此处需删除
                QQ: null,
                Phone: null,
                Email: null,
                Create_IP: null
            }, Value);
            if (Value.Phone && !(/^1\d{10}$/).test(Value.Phone)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "手机号码不正确：" + Value.Phone
                }));
                return;
            }
            if (Value.Email && !(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/).test(Value.Email)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "邮箱格式不正确：" + Value.Email
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        //*******************************!!!!!!!改
        Update_StatusApply: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Status` = :Status" +
                ", `Family_ID` = CASE :Status WHEN 0 THEN `Family_ID` ELSE NULL END" +
                ", `IDCard` = CASE :Status WHEN 0 THEN `IDCard` ELSE NULL END" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Status` = 2;";
            Value = KOC.Lodash.extend({
                Status: null,//审批类型： 0-申请成功，3-申请失败
                User_ID: null
            }, Value);
            Value.Status = KOC.StringUtils.ToInt(Value.Status, -1);
            //参数判断
            if (!KOC.Lodash.includes([0, 3], Value.Status)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Status"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        //*******************************!!!!!!!改
        Update_ApproveAdmin: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Approve_Admin_ID` = :Approve_Admin_ID" +
                ", `Approve_RealName` = :Approve_RealName" +
                ", `Approve_Date` = NOW()" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Approve_Admin_ID: null,//审批的管理员ID
                Approve_RealName: null//审批的管理员姓名
            }, Value);
            Value.User_ID = KOC.StringUtils.ToInt(Value.User_ID, -1);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_DutyAdmin: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Duty_Admin_ID` = :Duty_Admin_ID" +
                ", `Duty_RealName` = :Duty_RealName" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Duty_Admin_ID: null,//审批的管理员ID
                Duty_RealName: null//审批的管理员姓名
            }, Value);
            Value.User_ID = KOC.StringUtils.ToInt(Value.User_ID, -1);
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_CoverAdmin: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Cover_Admin_ID` = :Cover_Admin_ID" +
                ", `Cover_RealName` = :Cover_RealName" +
                ", `Cover_Date` = NOW()" +
                " WHERE `User_ID` = :User_ID;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Cover_Admin_ID: null,//审批的管理员ID
                Cover_RealName: null//审批的管理员姓名
            }, Value);
            Value.User_ID = KOC.StringUtils.ToInt(Value.User_ID, -1);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Status: function (Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Status` = :Status" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Status` IN (0, 1)" +
                " AND `Status` <> :Status;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Status: null
            }, Value);
            Value.Status = KOC.StringUtils.ToInt(Value.Status, -1);
            //参数判断
            if (!KOC.Lodash.includes([0, 1], Value.Status)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Status"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Update_Integral: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Integral` = `Integral` + CASE WHEN :Integral > 0 THEN :Integral ELSE 0 END" +
                ", `Integral_Week` = `Integral_Week` + CASE WHEN :Integral > 0 THEN :Integral ELSE 0 END" +
                ", `Integral_Month` = `Integral_Month` + CASE WHEN :Integral > 0 THEN :Integral ELSE 0 END" +
                ", `Integral_Date` = NOW()" +
                " WHERE `User_ID` = :User_ID" +
                " AND :Integral > 0";
            Value = KOC.Lodash.extend({
                User_ID: null,//艺人ID
                Integral: null//罚分值
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update_IsWeekStar: function (Value, callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `IsWeekStar` = :IsWeekStar";
            Value = KOC.Lodash.extend({
                User_ID: null,
                IsWeekStar: null
            }, Value);
            if (Value.User_ID && Value.User_ID > 0) {
                sql += " WHERE `User_ID` = :User_ID";
            }
            //每周凌晨维护一次WeekStar请求量级不超过12次，所以不使用缓存
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Update_Scheduler: function (callback) {
            var sql = "UPDATE `user_anchor`" +
                " SET `Pomelo_Today` = 0" +
                ", `Pomelo_Week` = CASE DAYOFWEEK(CURDATE()) WHEN 2 THEN 0 ELSE `Pomelo_Week` END" + //每周一凌晨
                ", `Pomelo_Month` = CASE DAYOFMONTH(CURDATE()) WHEN 1 THEN 0 ELSE `Pomelo_Month` END" +
                ", `Pomelo_Year` = CASE DAYOFYEAR(CURDATE()) WHEN 1 THEN 0 ELSE `Pomelo_Year` END" +
                ", `Integral_Week_Last` = CASE DAYOFWEEK(CURDATE()) WHEN 2 THEN `Integral_Week` ELSE `Integral_Week_Last` END" +//每周一凌晨
                ", `Integral_Week` = CASE DAYOFWEEK(CURDATE()) WHEN 2 THEN 0 ELSE `Integral_Week` END" +//每周一凌晨
                ", `Integral_Month_Last` = CASE DAYOFMONTH(CURDATE()) WHEN 1 THEN `Integral_Month` ELSE `Integral_Month_Last` END" +//每月一号
                ", `Integral_Month` = CASE DAYOFMONTH(CURDATE()) WHEN 1 THEN 0 ELSE `Integral_Month` END";//每月一号
            Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
        },
        Update_SchedulerForReport: function (callback) {
            var sql = "UPDATE `user_anchor` AS `tabUserAnchor` LEFT JOIN `koc-anchor-report`.`anchor_month` AS `tabAnchorMonth.Report`" +
                " ON `tabUserAnchor`.`User_ID` = `tabAnchorMonth.Report`.`User_ID`" +
                " SET `tabUserAnchor`.`ProtectDue_Date` =" +
                "  CASE WHEN" +
                "   DAY(CURDATE()) = 1" +
                "   AND" +
                "   `tabUserAnchor`.`ProtectDue_Date` IS NULL" +
                "   AND" +
                "   (" +
                "    `tabAnchorMonth.Report`.`IsProtectDue` = 1" +
                "    OR" +
                "    `tabUserAnchor`.`Create_Date` < DATE_ADD(DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 DAY), '%Y-%c-01'), INTERVAL -1 MONTH)" +
                "   )" +
                "  THEN" +
                "   DATE_ADD(DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 DAY), '%Y-%c-01'), INTERVAL 1 MONTH)" +
                "  ELSE" +
                "   `tabUserAnchor`.`ProtectDue_Date`" +
                "  END" +
                ", `tabUserAnchor`.`Score_Last` = CASE DAY(CURDATE()) WHEN 1 THEN IFNULL(`tabAnchorMonth.Report`.`Score`, 0) ELSE `tabUserAnchor`.`Score_Last` END" +
                ", `tabUserAnchor`.`Score_Coin_Last` = CASE DAY(CURDATE()) WHEN 1 THEN IFNULL(`tabAnchorMonth.Report`.`Score_Coin`, 0) ELSE `tabUserAnchor`.`Score_Coin_Last` END" +
                ", `tabUserAnchor`.`Score_SignUp_Last` = CASE DAY(CURDATE()) WHEN 1 THEN IFNULL(`tabAnchorMonth.Report`.`Score_SignUp`, 0) ELSE `tabUserAnchor`.`Score_SignUp_Last` END" +
                ", `tabUserAnchor`.`Score` = CASE DAY(CURDATE()) WHEN 1 THEN 0 ELSE IFNULL(`tabAnchorMonth.Report`.`Score`, 0) END" +
                ", `tabUserAnchor`.`Score_Coin` = CASE DAY(CURDATE()) WHEN 1 THEN 0 ELSE IFNULL(`tabAnchorMonth.Report`.`Score_Coin`, 0) END" +
                ", `tabUserAnchor`.`Score_SignUp` = CASE DAY(CURDATE()) WHEN 1 THEN 0 ELSE IFNULL(`tabAnchorMonth.Report`.`Score_SignUp`, 0) END" +
                " WHERE `tabAnchorMonth.Report`.`Report_Day` = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 DAY), '%Y-%c-01');";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
        },

        CacheParm: {
            Info: function (User_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_anchor` WHERE `User_ID` = :User_ID LIMIT 1;",
                    Parm: {User_ID: KOC.StringUtils.ToIntPositive(User_ID)}
                };
            },
            List_ChannelStrategy: function () {
                return {
                    DB: DBName,
                    SQL: " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'Recommend' AS `Type`" +
                    "   , `User_ID`" +
                    "   , `Create_Date`" +
                    "   FROM `user_anchor`" +
                    "   WHERE `Live` = 1" +
                    "   AND `Live_Stream_Status` = 1" +
                    "   AND `IsRecommend` = 1" +
                    "   LIMIT 50" +
                    "  ) AS `tabRecommend`" +
                    " UNION" +
                    " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'RatingS' AS `Type`" +
                    "   , `User_ID`" +
                    "   , `Create_Date`" +
                    "   FROM `user_anchor`" +
                    "   WHERE `Live` = 1" +
                    "   AND `Live_Stream_Status` = 1" +
                    "   AND `Rating` = 10" +
                    "   LIMIT 50" +
                    "  ) AS `tabRatingS`" +
                    " UNION" +
                    " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'RatingA' AS `Type`" +
                    "   , `User_ID`" +
                    "   , `Create_Date`" +
                    "   FROM `user_anchor`" +
                    "   WHERE `Live` = 1" +
                    "   AND `Live_Stream_Status` = 1" +
                    "   AND `Rating` = 9" +
                    "   LIMIT 50" +
                    "  ) AS `tabRatingA`" +
                    " UNION" +
                    " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'RatingB' AS `Type`" +
                    "   , `User_ID`" +
                    "   , `Create_Date`" +
                    "   FROM `user_anchor`" +
                    "   WHERE `Live` = 1" +
                    "   AND `Live_Stream_Status` = 1" +
                    "   AND `Rating` = 8" +
                    "   LIMIT 50" +
                    "  ) AS `tabRatingB`" +
                    " UNION" +
                    " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'IsWeekStar' AS `Type`" +
                    "   , `User_ID`" +
                    "   , `Create_Date`" +
                    "   FROM `user_anchor`" +
                    "   WHERE `Live` = 1" +
                    "   AND `Live_Stream_Status` = 1" +
                    "   AND `IsWeekStar` = 1" +
                    "   LIMIT 50" +
                    "  ) AS `tabWeekStar`" +
                    " UNION" +
                    " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'HotPrevious' AS `Type`" +
                    "   , `User_ID`" +
                    "   , `Create_Date`" +
                    "   FROM `user_anchor`" +
                    "   WHERE `Live` = 1" +
                    "   AND `Live_Stream_Status` = 1" +
                    "   ORDER BY `HotValue_Ranking`" +
                    "   LIMIT 50" +
                    "  ) AS `tabHotPrevious`" +
                    " UNION" +
                    " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'Hot' AS `Type`" +
                    "   , `user_anchor`.`User_ID`" +
                    "   , `user_anchor`.`Create_Date`" +
                    "   FROM `user_anchor` LEFT JOIN `user_anchor_hot`" +
                    "   ON `user_anchor`.`User_ID` = `user_anchor_hot`.`User_ID`" +
                    "   WHERE `user_anchor`.`Live` = 1" +
                    "   AND `user_anchor`.`Live_Stream_Status` = 1" +
                    "   ORDER BY `user_anchor_hot`.`Value` DESC" +
                    "   LIMIT 50" +
                    "  ) AS `tabHot`" +
                    " UNION" +
                    " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'New' AS `Type`" +
                    "   , `User_ID`" +
                    "   , `Create_Date`" +
                    "   FROM `user_anchor`" +
                    "   WHERE `Live` = 1" +
                    "   AND `Live_Stream_Status` = 1" +
                    "   AND `Create_Date` >= DATE_SUB(CURDATE(), INTERVAL 30 DAY)" +
                    "   ORDER BY `User_ID` DESC" +
                    "   LIMIT 50" +
                    "  ) AS `tabNew`" +
                    " UNION" +
                    " SELECT * FROM" +
                    "  (" +
                    "   SELECT 'Live' AS `Type`" +
                    "   , `User_ID`" +
                    "   , `Create_Date`" +
                    "   FROM `user_anchor`" +
                    "   WHERE `Live` = 1" +
                    "   AND `Live_Stream_Status` = 1" +
                    "   ORDER BY RAND()" +
                    "   LIMIT 50" +
                    "  ) AS `tabLive`;",
                    Parm: null
                };
            }
        }
    },
    //endregion
    //region User_Anchor_Hot:艺人热度表
    User_Anchor_Hot: {
        Insert: function (User_ID, callback) {
            var sql = "INSERT INTO `user_anchor_hot` (`User_ID`)" +
                " SELECT :User_ID FROM DUAL" +
                " WHERE NOT EXISTS (SELECT `User_ID` FROM `user_anchor_hot` WHERE `User_ID` = :User_ID) LIMIT 1;";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, {
                User_ID: User_ID
            }, callback);
        },
        Update: function (Value, callback) {
            Value = KOC.Lodash.extend({
                Type: null,
                Num: 0,
                Coin: 0,
                Value: 0,
                User_ID: null
            }, Value);
            var sql = "";
            switch (Value.Type) {
                case "Message":
                    sql = " `Message_Count` = `Message_Count` + 1" +
                        ", `Message_Value` = `Message_Value` + :Value" +
                        ", `Value` = `Value` + :Value";
                    break;
                case "Pomelo":
                    sql = " `Pomelo_Count` = `Pomelo_Count` + 1" +
                        ", `Pomelo_Num` = `Pomelo_Num` + :Num" +
                        ", `Pomelo_Value` = `Pomelo_Value` + (:Value * :Num)" +
                        ", `Value` = `Value` + (:Value * :Num)";
                    break;
                case "Gift":
                    sql = " `Gift_Count` = `Gift_Count` + 1" +
                        ", `Gift_Num` = `Gift_Num` + :Num" +
                        ", `Gift_Coin` = `Gift_Coin` + :Coin" +
                        ", `Gift_Value` = `Gift_Value` + (:Value * :Num)" +
                        ", `Value` = `Value` + (:Value * :Num)";
                    break;
                case "Guardin":
                    sql = " `Guardin_Count` = `Guardin_Count` + 1" +
                        ", `Guardin_Num` = `Guardin_Num` + :Num" +
                        ", `Guardin_Coin` = `Guardin_Coin` + :Coin" +
                        ", `Guardin_Value` = `Guardin_Value` + (:Value * :Num)" +
                        ", `Value` = `Value` + (:Value * :Num)";
                    break;
                case "Horn":
                    sql = " `Horn_Count` = `Horn_Count` + 1" +
                        ", `Horn_Coin` = `Horn_Coin` + :Coin" +
                        ", `Horn_Value` = `Horn_Value` + :Value" +
                        ", `Value` = `Value` + :Value";
                    break;
                case "SignUp":
                    sql = " `SignUp_Count` = `SignUp_Count` + 1" +
                        ", `SignUp_Value` = `SignUp_Value` + :Value" +
                        ", `Value` = `Value` + :Value";
                    break;
                default:
                    callback(KOC.ReturnValue.New({
                        hasError: true,
                        message: "Type Error"
                    }));
                    return;
            }
            sql = "UPDATE `user_anchor_hot`" +
                " SET " + sql +
                " WHERE `User_ID` = :User_ID" +
                " AND :Num >= 0" +
                " AND :Coin >= 0" +
                " AND :Value >= 0;";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Update_Next: function (callback) {
            var sql = "UPDATE `user_anchor_hot` AS `tabUserAnchorHot` JOIN `user_anchor` AS `tabUserAnchor`" +
                " ON `tabUserAnchorHot`.`User_ID` = `tabUserAnchor`.`User_ID`, (" +
                "  SELECT @rowNum := @rowNum + 1 AS `Ranking`, `User_ID`" +
                "  FROM `user_anchor_hot`, (SELECT @rowNum := 0) AS `tabRowNum`" +
                "  ORDER BY `Value` DESC" +
                " ) AS `tabRanking`" +
                " SET `tabUserAnchorHot`.`Value_Ranking_Previous` = `tabRanking`.`Ranking`" +
                ", `tabUserAnchorHot`.`Value_Previous` = `Value`" +
                ", `tabUserAnchorHot`.`Value` = (`tabUserAnchor`.`Score` * 5) + `tabUserAnchor`.`Score_Last`" +
                ", `tabUserAnchorHot`.`Score_Value` = `tabUserAnchor`.`Score` * 5" + // 本月评分*5
                ", `tabUserAnchorHot`.`Score_Last_Value` = `tabUserAnchor`.`Score_Last`" + // 上月评分
                ", `tabUserAnchorHot`.`Score` = `tabUserAnchor`.`Score`" +
                ", `tabUserAnchorHot`.`Score_Last` = `tabUserAnchor`.`Score_Last`" +
                ", `tabUserAnchorHot`.`Score_Coin` = `tabUserAnchor`.`Score_Coin`" +
                ", `tabUserAnchorHot`.`Score_Coin_Last` = `tabUserAnchor`.`Score_Coin_Last`" +
                ", `tabUserAnchorHot`.`Score_SignUp` = `tabUserAnchor`.`Score_SignUp`" +
                ", `tabUserAnchorHot`.`Score_SignUp_Last` = `tabUserAnchor`.`Score_SignUp_Last`" +
                ", `tabUserAnchorHot`.`Message_Count_Previous` = `Message_Count`" +
                ", `tabUserAnchorHot`.`Message_Count` = 0" +
                ", `tabUserAnchorHot`.`Message_Value_Previous` = `Message_Value`" +
                ", `tabUserAnchorHot`.`Message_Value` = 0" +
                ", `tabUserAnchorHot`.`Pomelo_Count_Previous` = `Pomelo_Count`" +
                ", `tabUserAnchorHot`.`Pomelo_Count` = 0" +
                ", `tabUserAnchorHot`.`Pomelo_Num_Previous` = `Pomelo_Num`" +
                ", `tabUserAnchorHot`.`Pomelo_Num` = 0" +
                ", `tabUserAnchorHot`.`Pomelo_Value_Previous` = `Pomelo_Value`" +
                ", `tabUserAnchorHot`.`Pomelo_Value` = 0" +
                ", `tabUserAnchorHot`.`Gift_Count_Previous` = `Gift_Count`" +
                ", `tabUserAnchorHot`.`Gift_Count` = 0" +
                ", `tabUserAnchorHot`.`Gift_Num_Previous` = `Gift_Num`" +
                ", `tabUserAnchorHot`.`Gift_Num` = 0" +
                ", `tabUserAnchorHot`.`Gift_Coin_Previous` = `Gift_Coin`" +
                ", `tabUserAnchorHot`.`Gift_Coin` = 0" +
                ", `tabUserAnchorHot`.`Gift_Value_Previous` = `Gift_Value`" +
                ", `tabUserAnchorHot`.`Gift_Value` = 0" +
                ", `tabUserAnchorHot`.`Guardin_Count_Previous` = `Guardin_Count`" +
                ", `tabUserAnchorHot`.`Guardin_Count` = 0" +
                ", `tabUserAnchorHot`.`Guardin_Num_Previous` = `Guardin_Num`" +
                ", `tabUserAnchorHot`.`Guardin_Num` = 0" +
                ", `tabUserAnchorHot`.`Guardin_Coin_Previous` = `Guardin_Coin`" +
                ", `tabUserAnchorHot`.`Guardin_Coin` = 0" +
                ", `tabUserAnchorHot`.`Guardin_Value_Previous` = `Guardin_Value`" +
                ", `tabUserAnchorHot`.`Guardin_Value` = 0" +
                ", `tabUserAnchorHot`.`Horn_Count_Previous` = `Horn_Count`" +
                ", `tabUserAnchorHot`.`Horn_Count` = 0" +
                ", `tabUserAnchorHot`.`Horn_Coin_Previous` = `Horn_Coin`" +
                ", `tabUserAnchorHot`.`Horn_Coin` = 0" +
                ", `tabUserAnchorHot`.`Horn_Value_Previous` = `Horn_Value`" +
                ", `tabUserAnchorHot`.`Horn_Value` = 0" +
                ", `tabUserAnchorHot`.`SignUp_Count_Previous` = `SignUp_Count`" +
                ", `tabUserAnchorHot`.`SignUp_Count` = 0" +
                ", `tabUserAnchorHot`.`SignUp_Value_Previous` = `SignUp_Value`" +
                ", `tabUserAnchorHot`.`SignUp_Value` = 0" +
                " WHERE `tabUserAnchorHot`.`User_ID` = `tabRanking`.`User_ID`;";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
        }
    },
    //endregion
    //region User_Anchor_Admin:艺人(房间)管理表
    User_Anchor_Admin: {
        Info: function (User_ID, User_ID_Anchor, callback) {
            var cacheParm = this.CacheParm.Info(User_ID, User_ID_Anchor);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        List: function (User_ID_Anchor, callback) {
            var sql = "SELECT `user_anchor_admin`.*" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`EXP`" +
                ", CASE WHEN `user_info`.`VIP` = 1 AND `user_info`.`VIP_Expire` >= NOW() THEN 1 ELSE 0 END AS `VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                " FROM `user_anchor_admin` JOIN `user_info`" +
                " ON `user_anchor_admin`.`User_ID` = `user_info`.`User_ID`" +
                " WHERE `user_anchor_admin`.`User_ID_Anchor` = :User_ID_Anchor;";
            Mysql_Helper.ExecuteTable(DBName, sql, {
                User_ID_Anchor: User_ID_Anchor
            }, callback);
        },
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `user_anchor_admin`" +
                " (`User_ID`" +
                ", `User_ID_Anchor`" +
                ", `Create_Date`)" +
                " VALUES (:User_ID" +
                ", :User_ID_Anchor" +
                ", NOW());";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Anchor: null
            }, Value);
            if (KOC.StringUtils.ToIntPositive(Value.User_ID) == KOC.StringUtils.ToIntPositive(Value.User_ID_Anchor)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "不能设置自己为房间管理员"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Delete: function (Value, callback) {
            var sql = "DELETE FROM `user_anchor_admin`" +
                " WHERE `User_ID` = :User_ID" +
                " AND `User_ID_Anchor` = :User_ID_Anchor;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Anchor: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID, Value.User_ID_Anchor));
        },
        CacheParm: {
            Info: function (User_ID, User_ID_Anchor) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_anchor_admin`" +
                    " WHERE `User_ID` = :User_ID " +
                    " AND `User_ID_Anchor` = :User_ID_Anchor" +
                    " LIMIT 1;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID),
                        User_ID_Anchor: KOC.StringUtils.ToIntPositive(User_ID_Anchor)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Anchor_Blacklist:艺人(房间)黑名单表
    User_Anchor_Blacklist: {
        Info: function (User_ID, User_ID_Anchor, callback) {
            var cacheParm = this.CacheParm.Info(User_ID, User_ID_Anchor);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    if (retValue.returnObject.Join && retValue.returnObject.Join_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.Join_Expire))) {
                        retValue.returnObject.Join = 0;
                    }
                    if (retValue.returnObject.Shutup && retValue.returnObject.Shutup_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.Shutup_Expire))) {
                        retValue.returnObject.Shutup = 0;
                    }
                }
                callback(retValue);
            });
        },
        List: function (User_ID_Anchor, callback) {
            var sql = "SELECT `user_anchor_blacklist`.`User_ID`" +
                ", `user_anchor_blacklist`.`User_ID_Anchor`" +
                ", CASE WHEN `user_anchor_blacklist`.`Join` = 1 AND (`user_anchor_blacklist`.`Join_Expire` IS NULL OR `user_anchor_blacklist`.`Join_Expire` >= NOW()) THEN 1 ELSE 0 END AS `Join`" +
                ", `user_anchor_blacklist`.`Join_Expire`" +
                ", CASE WHEN `user_anchor_blacklist`.`Shutup` = 1 AND (`user_anchor_blacklist`.`Shutup_Expire` IS NULL OR `user_anchor_blacklist`.`Shutup_Expire` >= NOW()) THEN 1 ELSE 0 END AS `Shutup`" +
                ", `user_anchor_blacklist`.`Shutup_Expire`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`EXP`" +
                ", CASE WHEN `user_info`.`VIP` = 1 AND `user_info`.`VIP_Expire` >= NOW() THEN 1 ELSE 0 END AS `VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                " FROM `user_anchor_blacklist` JOIN `user_info`" +
                " ON `user_anchor_blacklist`.`User_ID` = `user_info`.`User_ID`" +
                " WHERE `user_anchor_blacklist`.`User_ID_Anchor` = :User_ID_Anchor" +
                " AND ((`user_anchor_blacklist`.`Join` = 1 AND (`user_anchor_blacklist`.`Join_Expire` IS NULL OR `user_anchor_blacklist`.`Join_Expire` >= NOW())) OR (`user_anchor_blacklist`.`Shutup` = 1 AND (`user_anchor_blacklist`.`Shutup_Expire` IS NULL OR `user_anchor_blacklist`.`Shutup_Expire` >= NOW())));";
            Mysql_Helper.ExecuteTable(DBName, sql, {
                User_ID_Anchor: User_ID_Anchor
            }, callback);
        },
        Insert: function (Value, callback) {
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Anchor: null,
                Join: null,
                Join_Mode: null,
                Join_Value: null,
                Shutup: null,
                Shutup_Mode: null,
                Shutup_Value: null
            }, Value);
            var sql = "INSERT INTO `user_anchor_blacklist`" +
                " (`User_ID`" +
                ", `User_ID_Anchor`" +
                ", `Join`" +
                ", `Join_Expire`" +
                ", `Shutup`" +
                ", `Shutup_Expire`)" +
                " VALUES (:User_ID" +
                ", :User_ID_Anchor" +
                ", IFNULL(:Join, 0)" +
                ", CASE WHEN :Join_Mode IS NULL OR :Join_Mode = 'NEVER' THEN NULL ELSE DATE_ADD(NOW(), INTERVAL :Join_Value " + (Value.Join_Mode == "NEVER" || !Value.Join_Mode ? "YEAR" : Value.Join_Mode) + ") END" +
                ", IFNULL(:Shutup, 0)" +
                ", CASE WHEN :Shutup_Mode IS NULL OR :Shutup_Mode = 'NEVER' THEN NULL ELSE DATE_ADD(NOW(), INTERVAL :Shutup_Value " + (Value.Shutup_Mode == "NEVER" || !Value.Shutup_Mode ? "YEAR" : Value.Shutup_Mode) + ") END);";
            if (Value.Join_Mode && !KOC.Lodash.includes(["NEVER", "YEAR", "MONTH", "WEEK", "DAY", "HOUR", "MINUTE"], Value.Join_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Join_Mode"
                }));
                return;
            }
            if (Value.Join_Value && Value.Join_Value <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Join_Value"
                }));
                return;
            }
            if (Value.Shutup_Mode && !KOC.Lodash.includes(["NEVER", "YEAR", "MONTH", "WEEK", "DAY", "HOUR", "MINUTE"], Value.Shutup_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Shutup_Mode"
                }));
                return;
            }
            if (Value.Shutup_Value && Value.Shutup_Value <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Shutup_Value"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Update: function (Value, callback) {
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Anchor: null,
                Join: null,
                Join_Mode: null,
                Join_Value: null,
                Shutup: null,
                Shutup_Mode: null,
                Shutup_Value: null
            }, Value);
            var sql = "UPDATE `user_anchor_blacklist`" +
                " SET `Join` = IFNULL(:Join, `Join`)" +
                ", `Join_Expire` = CASE WHEN :Join_Mode IS NULL THEN `Join_Expire` ELSE CASE :Join_Mode WHEN 'NEVER' THEN NULL ELSE DATE_ADD((case when `Join` is true and unix_timestamp(`Join_Expire`) > unix_timestamp(now()) then `Join_Expire` else now() end), INTERVAL :Join_Value " + (Value.Join_Mode == "NEVER" || !Value.Join_Mode ? "YEAR" : Value.Join_Mode) + ") END END" +
                ", `Shutup` = IFNULL(:Shutup, `Shutup`)" +
                ", `Shutup_Expire` = CASE WHEN :Shutup_Mode IS NULL THEN `Shutup_Expire` ELSE CASE :Shutup_Mode WHEN 'NEVER' THEN NULL ELSE DATE_ADD((case when `Shutup` is true and unix_timestamp(`Shutup_Expire`) > unix_timestamp(now()) then `Shutup_Expire` else now() end), INTERVAL :Shutup_Value " + (Value.Shutup_Mode == "NEVER" || !Value.Shutup_Mode ? "YEAR" : Value.Shutup_Mode) + ") END END" +
                " WHERE `User_ID` = :User_ID" +
                " AND `User_ID_Anchor` = :User_ID_Anchor" +
                " AND IFNULL(:Join_Value, 0) >= 0" +
                " AND ROUND(IFNULL(:Join_Value, 0)) = IFNULL(:Join_Value, 0)" +
                " AND IFNULL(:Shutup_Value, 0) >= 0" +
                " AND ROUND(IFNULL(:Shutup_Value, 0)) = IFNULL(:Shutup_Value, 0);";
            if (Value.Join_Mode && !KOC.Lodash.includes(["NEVER", "YEAR", "MONTH", "WEEK", "DAY", "HOUR", "MINUTE"], Value.Join_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Join_Mode"
                }));
                return;
            }
            if (Value.Shutup_Mode && !KOC.Lodash.includes(["NEVER", "YEAR", "MONTH", "WEEK", "DAY", "HOUR", "MINUTE"], Value.Shutup_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Shutup_Mode"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID, Value.User_ID_Anchor));
        },
        Update_Scheduler: function (callback) {
            var sql = "UPDATE `user_anchor_blacklist`" +
                " SET `Join` = CASE WHEN `Join` = 1 AND `Join_Expire` IS NOT NULL AND `Join_Expire` < NOW() THEN 0 ELSE `Join` END" +
                ", `Shutup` = CASE WHEN `Shutup` = 1 AND `Shutup_Expire` IS NOT NULL AND `Shutup_Expire` < NOW() THEN 0 ELSE `Shutup` END";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
        },
        Delete_Scheduler: function (callback) {
            var sql = "DELETE FROM `user_anchor_blacklist` WHERE `Join` = 0 AND `Shutup` = 0";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
        },
        CacheParm: {
            Info: function (User_ID, User_ID_Anchor) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM  `user_anchor_blacklist`" +
                    " WHERE User_ID = :User_ID" +
                    " AND User_ID_Anchor = :User_ID_Anchor" +
                    " LIMIT 1;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID),
                        User_ID_Anchor: KOC.StringUtils.ToIntPositive(User_ID_Anchor)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Anchor_Guardian:艺人守护表
    User_Anchor_Guardian: {
        Info: function (Conn, User_ID, User_ID_Guardian, callback) {
            var cacheParm = this.CacheParm.Info(User_ID, User_ID_Guardian);
            Mysql_Helper.ExecuteRowCache(Conn || DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    retValue.returnObject.Guardian_ExpireStatus = retValue.returnObject.Guardian_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.Guardian_Expire)) ? 1 : 0;
                }
                callback(retValue);
            });
        },
        List_Anchor: function (User_ID, callback) {
            var sql = "SELECT `user_anchor_guardian`.*" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`EXP`" +
                ", CASE WHEN `user_info`.`VIP` = 1 AND `user_info`.`VIP_Expire` >= NOW() THEN 1 ELSE 0 END AS `VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                " FROM `user_anchor_guardian` JOIN `user_info`" +
                " ON `user_anchor_guardian`.`User_ID_Guardian` = `user_info`.`User_ID`" +
                " WHERE `user_anchor_guardian`.`User_ID` = :User_ID" +
                " AND `user_anchor_guardian`.`Guardian_Expire` >= NOW();";
            Mysql_Helper.ExecuteTable(DBName, sql, {
                User_ID: User_ID
            }, callback);
        },
        List_Guardian: function (User_ID, callback) {
            var sql = "SELECT `user_anchor_guardian`.*" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`EXP`" +
                ", CASE WHEN `user_info`.`VIP` = 1 AND `user_info`.`VIP_Expire` >= NOW() THEN 1 ELSE 0 END AS `VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                " FROM `user_anchor_guardian` JOIN `user_info`" +
                " ON `user_anchor_guardian`.`User_ID` = `user_info`.`User_ID`" +
                " WHERE `user_anchor_guardian`.`User_ID_Guardian` = :User_ID" +
                " AND `user_anchor_guardian`.`Guardian_Expire` >= NOW()" +
                " ORDER BY `user_anchor_guardian`.`Guardian_Expire` DESC, `VIP` DESC, `user_info`.`EXP` DESC;";
            Mysql_Helper.ExecuteTable(DBName, sql, {
                User_ID: User_ID
            }, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_anchor_guardian`" +
                " (`User_ID`" +
                ", `User_ID_Guardian`" +
                ", `Guardian_Expire`" +
                ", `Guardian_ID`" +
                ", `Guardian_Name`" +
                ", `Guardian_Mode`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:User_ID" +
                ", :User_ID_Guardian" +
                ", DATE_ADD(NOW(), INTERVAL :Guardian_Value " + Value.Guardian_Mode + ")" +
                ", :Guardian_ID" +
                ", :Guardian_Name" +
                ", :Guardian_Mode" +
                ", NOW()" +
                ", :Create_IP)";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Guardian: null,
                Guardian_Mode: null,
                Guardian_Value: null,
                Guardian_ID: null,
                Guardian_Name: null,
                Create_IP: null
            }, Value);
            if (!KOC.Lodash.includes(["YEAR", "MONTH", "WEEK", "DAY"], Value.Guardian_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Guardian_Mode"
                }));
                return;
            }
            if (Value.Guardian_Value <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Guardian_Value"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor_guardian`" +
                " SET `Guardian_Expire` = DATE_ADD(CASE WHEN `Guardian_Expire` > NOW() THEN `Guardian_Expire` ELSE NOW() END, INTERVAL :Guardian_Value " + Value.Guardian_Mode + ")" +
                ", `Guardian_ID` = :Guardian_ID" +
                ", `Guardian_Name` = :Guardian_Name" +
                ", `Guardian_Mode` = :Guardian_Mode" +
                " WHERE `User_ID` = :User_ID" +
                " AND `User_ID_Guardian` = :User_ID_Guardian" +
                " AND :Guardian_Value > 0" +
                " AND ROUND(:Guardian_Value) = :Guardian_Value;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Guardian: null,
                Guardian_Mode: null,
                Guardian_Value: null,
                Guardian_ID: null,
                Guardian_Name: null
            }, Value);
            if (!KOC.Lodash.includes(["YEAR", "MONTH", "WEEK", "DAY"], Value.Guardian_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Guardian_Mode"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID, Value.User_ID_Guardian));
        },
        CacheParm: {
            Info: function (User_ID, User_ID_Guardian) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_anchor_guardian`" +
                    " WHERE `User_ID` = :User_ID" +
                    " AND `User_ID_Guardian` = :User_ID_Guardian" +
                    " LIMIT 1;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID),
                        User_ID_Guardian: KOC.StringUtils.ToIntPositive(User_ID_Guardian)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Anchor_Cover:艺人海报表单
    //*******************************!!!!!!!改
    User_Anchor_Cover: {
        Info: function (Value, callback) {
            var sql = "SELECT `User_ID` " +
                ",`NickName`" +
                ",`Image`" +
                ",`Create_Date`" +
                ",`Create_IP`" +
                ",`Status` FROM `user_anchor_cover`" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Type` = :Type Limit 1";
            Mysql_Helper.ExecuteRow(DBName, sql, {User_ID: Value.User_ID, Type: Value.Type}, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_anchor_cover`" +
                "(`User_ID`" +
                ", `Type`" +
                ", `NickName`" +
                ", `Image`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES ( :User_ID" +
                ", :Type" +
                ", :NickName" +
                ", :Image" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                User_ID: null,//艺人ID
                NickName: null,
                Image: null,
                Type: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback);
        },
        Update_Status: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor_cover` " +
                "SET `Status` = :Status" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Type` = :Type" +
                " AND `Status` = 1";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Type: null,
                Status: null
            }, Value);
            if (!KOC.Lodash.includes([0, 2], Value.Status)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Status"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback);
        },
        Update_Image: function (Conn, Value, callback) {
            var sql = "UPDATE `user_anchor_cover` " +
                "SET `Status` = 1" +
                ", `Image` = :Image" +
                ", `Create_Date` = NOW()" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Type` = :Type" +
                " AND `Status` in (0,1,2)";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Type: null,
                Image: null//艺人海报图片地址
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback);
        }
    },
    //endregion
    //region User_Mounts:用户座骑表
    User_Mounts: {
        Info: function (User_ID, Mounts_ID, callback) {
            var cacheParm = this.CacheParm.Info(User_ID, Mounts_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    retValue.returnObject.Mounts_ExpireStatus = retValue.returnObject.Mounts_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.Mounts_Expire)) ? 1 : 0;
                }
                callback(retValue);
            });
        },
        List: function (User_ID, callback) {
            var cacheParm = this.CacheParm.List(User_ID);
            Mysql_Helper.ExecuteTableCache(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                KOC.Lodash.forEach(retValue.returnObject, function (ThisValue) {
                    ThisValue.Mounts_ExpireStatus = ThisValue.Mounts_Expire && KOC.Moment().isAfter(KOC.Moment(ThisValue.Mounts_Expire)) ? 1 : 0;
                    ThisValue.Mounts_ExpireDay = KOC.Moment(ThisValue.Mounts_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(ThisValue.Mounts_Expire).diff(KOC.Moment(), "days");
                });
                callback(retValue);
            });
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_mounts`" +
                " (`User_ID`" +
                ", `Mounts_ID`" +
                ", `Mounts_Name`" +
                ", `Mounts_Expire`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:User_ID" +
                ", :Mounts_ID" +
                ", :Mounts_Name" +
                ", DATE_ADD(NOW(), INTERVAL :Mounts_Value " + Value.Mounts_Mode + ")" +
                ", NOW()" +
                ", :Create_IP)" +
                " ON DUPLICATE KEY" +
                " UPDATE `Mounts_Expire` = DATE_ADD(CASE WHEN `Mounts_Expire` > NOW() THEN `Mounts_Expire` ELSE NOW() END, INTERVAL :Mounts_Value " + Value.Mounts_Mode + ")" +
                ", `Mounts_Name` = :Mounts_Name;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Mounts_ID: null,
                Mounts_Mode: null,
                Mounts_Value: null,
                Mounts_Name: null,
                Create_IP: null
            }, Value);
            Value.Mounts_Value = KOC.StringUtils.ToInt(Value.Mounts_Value);
            if (Value.Mounts_Value <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Mounts_Value"
                }));
                return;
            }
            if (!KOC.Lodash.includes(["YEAR", "MONTH", "WEEK", "DAY"], Value.Mounts_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Mounts_Mode"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, [this.CacheParm.Info(Value.User_ID, Value.Mounts_ID), this.CacheParm.List(Value.User_ID)]);
        },
        CacheParm: {
            Info: function (User_ID, Mounts_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_mounts`" +
                    " WHERE `User_ID` = :User_ID" +
                    " AND `Mounts_ID` = :Mounts_ID" +
                    " LIMIT 1;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID),
                        Mounts_ID: KOC.StringUtils.ToIntPositive(Mounts_ID)
                    }
                };
            },
            List: function (User_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_mounts`" +
                    " WHERE `User_ID` = :User_ID" +
                    " ORDER BY `Mounts_Expire` DESC;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Emblem:用户徽章表
    User_Emblem: {
        Info: function (User_ID, Item_ID, callback) {
            var cacheParm = this.CacheParm.Info(User_ID, Item_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    retValue.returnObject.Item_ExpireStatus = retValue.returnObject.Item_Expire && KOC.Moment().isAfter(KOC.Moment(retValue.returnObject.Item_Expire)) ? 1 : 0;
                }
                callback(retValue);
            });
        },
        List: function (User_ID, callback) {
            var sql = "SELECT * FROM `user_emblem`" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Item_Expire` > NOW()";
            Mysql_Helper.ExecuteTable(DBName, sql, {
                User_ID: User_ID
            }, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_emblem`" +
                " (`User_ID`" +
                ", `Item_ID`" +
                ", `Item_Name`" +
                ", `Item_Type`" +
                ", `Item_Expire`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:User_ID" +
                ", :Item_ID" +
                ", :Item_Name" +
                ", :Item_Type" +
                ", DATE_ADD(NOW(), INTERVAL :Item_Value " + Value.Item_Mode + ")" +
                ", NOW()" +
                ", :Create_IP)" +
                " ON DUPLICATE KEY" +
                " UPDATE `Item_Expire` = DATE_ADD(CASE WHEN `Item_Expire` > NOW() THEN `Item_Expire` ELSE NOW() END, INTERVAL :Item_Value " + Value.Item_Mode + ")" +
                ", `Item_Name` = :Item_Name;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Item_ID: null,
                Item_Mode: null,
                Item_Value: null,
                Item_Name: null,
                Item_Type: null,
                Create_IP: null
            }, Value);
            Value.Item_Value = KOC.StringUtils.ToInt(Value.Item_Value);
            if (Value.Item_Value <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Item_Value"
                }));
                return;
            }
            if (!KOC.Lodash.includes(["YEAR", "MONTH", "WEEK", "DAY"], Value.Item_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Item_Mode"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID, Value.Item_ID));
        },
        CacheParm: {
            Info: function (User_ID, Item_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_emblem`" +
                    " WHERE `User_ID` = :User_ID" +
                    " AND `Item_ID` = :Item_ID" +
                    " LIMIT 1;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID),
                        Mounts_ID: KOC.StringUtils.ToIntPositive(Item_ID)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Package:用户包裹表
    User_Package: {
        Info: function (User_ID, Item_Type, Item_ID, callback) {
            var cacheParm = this.CacheParm.Info(User_ID, Item_Type, Item_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (!retValue.hasError && retValue.returnObject) {
                    switch (retValue.returnObject.Item_Type) {
                        case "Gift":
                            retValue.returnObject.Item_Info = CommonUtils.Commodity.Gift.fnInfo(KOC.StringUtils.ToIntPositive(retValue.returnObject.Item_ID));
                            break;
                        case "Horn":
                            retValue.returnObject.Item_Info = CommonUtils.Commodity.Horn.fnInfo(retValue.returnObject.Item_ID);
                            break;
                        default:
                            retValue.returnObject = null;
                            break;
                    }
                }
                callback(retValue);
            });
        },
        List: function (User_ID, callback) {
            var cacheParm = this.CacheParm.List(User_ID);
            Mysql_Helper.ExecuteTable(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (retValue.hasError) {
                    callback(retValue);
                    return;
                }
                KOC.Lodash.forEach(retValue.returnObject, function (ThisValue) {
                    switch (ThisValue.Item_Type) {
                        case "Gift":
                            ThisValue.Item_Info = CommonUtils.Commodity.Gift.fnInfo(KOC.StringUtils.ToIntPositive(ThisValue.Item_ID));
                            break;
                        case "Horn":
                            ThisValue.Item_Info = CommonUtils.Commodity.Horn.fnInfo(ThisValue.Item_ID);
                            break;
                    }
                });
                callback(retValue);
            });
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_package`" +
                " (`User_ID`" +
                ", `Item_Type`" +
                ", `Item_ID`" +
                ", `Item_Name`)" +
                " VALUES (:User_ID" +
                ", :Item_Type" +
                ", :Item_ID" +
                ", :Item_Name);";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Item_Type: null,
                Item_ID: null,
                Item_Name: null
            }, Value);
            if (!KOC.Lodash.includes(["Gift", "Horn"], Value.Item_Type)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Item_Type"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update: function (Conn, Value, callback) {
            var sql = "UPDATE `user_package`" +
                " SET `Num` = `Num` + (:Trade_Flag * :Trade_Num)" +
                ", `Item_Name` = IFNULL(:Item_Name, `Item_Name`)" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Item_Type` = :Item_Type" +
                " AND `Item_ID` = :Item_ID" +
                " AND `Num` + (:Trade_Flag * :Trade_Num) >= 0" +
                " AND :Trade_Flag IN (-1, 1)" +
                " AND :Trade_Num > 0" +
                " AND ROUND(:Trade_Num) = :Trade_Num;";
            Value = KOC.Lodash.extend({
                Trade_Flag: null,
                Trade_Num: null,
                User_ID: null,
                Item_Type: null,
                Item_ID: null,
                Item_Name: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, [this.CacheParm.Info(Value.User_ID, Value.Item_Type, Value.Item_ID), this.CacheParm.List(Value.User_ID)]);
        },
        CacheParm: {
            Info: function (User_ID, Item_Type, Item_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_package`" +
                    " WHERE `User_ID` = :User_ID" +
                    " AND `Item_Type` = :Item_Type" +
                    " AND `Item_ID` = :Item_ID" +
                    " AND `Num` > 0" +
                    " LIMIT 1;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID),
                        Item_Type: Item_Type,
                        Item_ID: Item_ID
                    }
                };
            },
            List: function (User_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_package`" +
                    " WHERE `User_ID` = :User_ID" +
                    " AND `Num` > 0;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Package_Trade:用户包裹交易记录
    User_Package_Trade: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_package_trade`" +
                "(`User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `Item_Type`" +
                ", `Item_ID`" +
                ", `Item_Name`" +
                ", `Trade_Type`" +
                ", `Trade_Type_Name`" +
                ", `Trade_Flag`" +
                ", `Trade_Num`" +
                ", `Trade_Order_No`" +
                ", `Num`" +
                ", `Remark`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " SELECT `user_info`.`User_ID`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_package`.`Item_Type`" +
                ", `user_package`.`Item_ID`" +
                ", `user_package`.`Item_Name`" +
                ", :Trade_Type" +
                ", :Trade_Type_Name" +
                ", :Trade_Flag" +
                ", :Trade_Num" +
                ", :Trade_Order_No" +
                ", `user_package`.`Num`" +
                ", :Remark" +
                ", NOW()" +
                ", :Create_IP" +
                " FROM `user_info` JOIN `user_package`" +
                " ON `user_info`.`User_ID` = `user_package`.`User_ID`" +
                " WHERE `user_info`.`User_ID` = :User_ID" +
                " AND `user_package`.`Item_Type` = :Item_Type" +
                " AND `user_package`.`Item_ID` = :Item_ID" +
                " AND :Trade_Flag IN (1, -1)" +
                " AND :Trade_Num > 0" +
                " AND ROUND(:Trade_Num) = :Trade_Num;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Item_Type: null,
                Item_ID: null,
                Trade_Type: null,
                Trade_Type_Name: null,
                Trade_Flag: null,
                Trade_Num: null,
                Trade_Order_No: null,
                Remark: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        }
    },
    //endregion
    //region User_Family:公会成员信息表
    User_Family: {
        Info: function (User_ID, callback) {
            var cacheParm = this.CacheParm.Info(User_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_family`" +
                " (`User_ID`" +
                ", `Family_ID`" +
                ", `IsMaster`" +
                ", `RightCode`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:User_ID" +
                ", :Family_ID" +
                ", :IsMaster" +
                ", :RightCode" +
                ", NOW()" +
                ", :Create_IP)";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Family_ID: null,
                IsMaster: null,
                RightCode: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        CacheParm: {
            Info: function (User_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_family` WHERE `User_ID` = :User_ID LIMIT 1;",
                    Parm: {User_ID: KOC.StringUtils.ToIntPositive(User_ID)}
                };
            }
        }
    },
    //endregion
    //region User_Admin:管理员信息表
    User_Admin: {
        Insert: function (Conn, Value, callback) {
            var sql = 'INSERT INTO `user_admin`' +
                '(`User_ID`' +
                ' ,`RealName`' +
                ' ,`Phone`' +
                ' ,`RightCode`' +
                ' ,`Status`' +
                ' ,`Create_Date`' +
                ' ,`Create_IP`)' +
                " VALUES (:User_ID" +
                " , :RealName" +
                " , :Phone" +
                " , :RightCode" +
                " , :Status" +
                " ,NOW()" +
                " ,:Create_IP);";
            Value = KOC.Lodash.extend({
                User_ID: null,
                RealName: null,
                Phone: null,
                //Login_Password: KOC.StringUtils.MD5(Value.Phone.length > 6 ? Value.Phone.substr(Value.Phone.length - 6) : ""),
                RightCode: null,
                Status: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update: function (Conn, Value, callback) {
            var sql = 'UPDATE `User_Admin` SET `RealName` = :RealName' +
                ', `Phone` = :Phone' +
                ', `IsMaster` = :IsMaster' +
                ', `RightCode` = :RightCode' +
                ', `Status` = :Status' +
                ' WHERE `User_ID` = :User_ID;';
            Value = KOC.Lodash.extend({
                User_ID: null,
                RealName: null,
                Phone: null,
                IsMaster: null,
                RightCode: null,
                Status: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback, this.CacheParm.Info(Value.User_ID));
        },
        Info: function (User_ID, callback) {
            var cacheParm = this.CacheParm.Info(User_ID);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        Info_ALL: function (callback) {
            //获取
            var sql = "SELECT `user_admin`.`User_ID`" +
                ", `user_admin`.`Phone`" +
                ", `user_admin`.`RealName`" +
                ", `user_admin`.`IsMaster`" +
                ", `user_admin`.`RightCode`" +
                ", `user_admin`.`Create_Date`" +
                ", `user_admin`.`Create_IP`" +
                " FROM `user_admin`" +
                " WHERE `user_admin`.`Status` < 1 ";
            Mysql_Helper.ExecuteTable(DBName, sql, {}, callback);
        },
        Info_Phone: function (Phone, callback) {
            var sql = "SELECT User_ID FROM `user_admin` WHERE Phone = :Phone";
            Mysql_Helper.ExecuteRow(DBName, sql, {Phone: Phone}, callback);
        },
        CacheParm: {
            Info: function (User_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_admin` WHERE `User_ID` = :User_ID LIMIT 1;",
                    Parm: {User_ID: KOC.StringUtils.ToIntPositive(User_ID)}
                };
            }
        }
    },
    //endregion
    //region User_Bank_Trade:用户帐户资金交易记录
    User_Bank_Trade: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_bank_trade`" +
                "(`User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `User_Channel_ID`" +
                ", `Related_User_ID`" +
                ", `Related_User_NickName`" +
                ", `Related_User_RealName`" +
                ", `Related_Family_ID`" +
                ", `Related_Family_Name`" +
                ", `Trade_Currency`" +
                ", `Trade_Type`" +
                ", `Trade_Type_Name`" +
                ", `Trade_Flag`" +
                ", `Trade_Amt`" +
                ", `Trade_Order_No`" +
                ", `Amt`" +
                ", `Remark`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " SELECT `User_ID`" +
                ", `NickName`" +
                ", `RealName`" +
                ", `Channel_ID`" +
                ", :Related_User_ID" +
                ", :Related_User_NickName" +
                ", :Related_User_RealName" +
                ", :Related_Family_ID" +
                ", :Related_Family_Name" +
                ", :Trade_Currency" +
                ", :Trade_Type" +
                ", :Trade_Type_Name" +
                ", :Trade_Flag" +
                ", :Trade_Amt" +
                ", :Trade_Order_No" +
                ", CASE :Trade_Currency WHEN 1 THEN `Coin` ELSE `Beans` END" +
                ", :Remark" +
                ", NOW()" +
                ", :Create_IP" +
                " FROM `user_info`" +
                " WHERE `User_ID` = :User_ID" +
                " AND :Trade_Currency IN (1, 2)" +
                " AND :Trade_Flag IN (1, -1)" +
                " AND :Trade_Amt > 0" +
                " AND ROUND(:Trade_Amt) = :Trade_Amt;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Related_User_ID: null,
                Related_User_NickName: null,
                Related_User_RealName: null,
                Related_Family_ID: null,
                Related_Family_Name: null,
                Trade_Currency: null,
                Trade_Type: null,
                Trade_Type_Name: null,
                Trade_Flag: null,
                Trade_Amt: null,
                Trade_Order_No: null,
                Remark: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        }
    },
    //endregion
    //region User_Attention:用户关注表
    User_Attention: {
        Info: function (User_ID, User_ID_Attention, callback) {
            var cacheParm = this.CacheParm.Info(User_ID, User_ID_Attention);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_attention`" +
                " (`User_ID`" +
                ", `User_ID_Attention`" +
                ", `Create_Date`)" +
                " VALUES (:User_ID" +
                ", :User_ID_Attention" +
                ", NOW());";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Attention: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Delete: function (Conn, Value, callback) {
            var sql = "DELETE FROM `user_attention`" +
                " WHERE `User_ID` = :User_ID" +
                " AND `User_ID_Attention` = :User_ID_Attention;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Attention: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.User_ID, Value.User_ID_Attention));
        },
        CacheParm: {
            Info: function (User_ID, User_ID_Attention) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_attention`" +
                    " WHERE `User_ID` = :User_ID" +
                    " AND `User_ID_Attention` = :User_ID_Attention" +
                    " LIMIT 1;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID),
                        User_ID_Attention: KOC.StringUtils.ToIntPositive(User_ID_Attention)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Task:用户任务表
    User_Task: {
        Info: function (User_ID, Task_ID, Task_Mode, Task_Date, callback) {
            var cacheParm = this.CacheParm.Info(User_ID, Task_ID, Task_Mode, Task_Date);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        List: function (Value, callback) {
            Value = KOC.Lodash.extend({
                User_ID: null,
                Mode: null,
                Status: null
            }, Value);
            if (Value.Status != undefined && Value.Status != "") {
                Value.Status = String(Value.Status).split(",");
            }
            if (Value.Mode != undefined && Value.Status != "") {
                Value.Mode = String(Value.Mode).split(",");
            }
            var cacheParm = this.CacheParm.List(Value.User_ID);
            Mysql_Helper.ExecuteTableCache(DBName, cacheParm.SQL, cacheParm.Parm, function (retValue) {
                if (retValue.hasError) {
                    callback(retValue);
                    return;
                }
                // 添加未开始任务
                if (!Value.Status || KOC.Lodash.includes(Value.Status, 1)) {
                    KOC.Lodash.forEach(CommonUtils.Task.Data, function (ThisValue) {
                        if (ThisValue.Status !== 0) {
                            return true;
                        }
                        if (Value.Mode && !KOC.Lodash.includes(Value.Mode, ThisValue.Mode)) {
                            return true;
                        }
                        var _Task_Date = "";
                        switch (ThisValue.Mode) {
                            case "DAY":
                                _Task_Date = KOC.Moment().format("YYYYMMDD");
                                break;
                            case "WEEK":
                                _Task_Date = KOC.Moment().startOf("isoWeek").format("YYYYMMDD");
                                break;
                            case "MONTH":
                                _Task_Date = KOC.Moment().startOf("month").format("YYYYMMDD");
                                break;
                            case "YEAR":
                                _Task_Date = KOC.Moment().startOf("year").format("YYYYMMDD");
                                break;
                        }
                        if (KOC.Lodash.find(retValue.returnObject, {Task_ID: ThisValue.id, Task_Date: _Task_Date})) {
                            return true;
                        }
                        retValue.returnObject.push({
                            User_ID: Value.User_ID,
                            User_NickName: "",
                            User_RealName: "",
                            Task_ID: ThisValue.id,
                            Task_Name: ThisValue.Name,
                            Task_Date: _Task_Date,
                            Task_Mode: ThisValue.Mode,
                            Task_Progress: 0,
                            Task_Objective: ThisValue.Objective,
                            Task_Reward: ThisValue.Reward,
                            Completion_Date: null,
                            Receive_Date: null,
                            Create_Date: new Date(),
                            Create_IP: "",
                            Status: 1
                        });
                    });
                }
                // 过滤:Mode, Status
                if (Value.Mode || Value.Status) {
                    KOC.Lodash.remove(retValue.returnObject, function (ThisValue) {
                        return ((Value.Mode && !KOC.Lodash.includes(Value.Mode, ThisValue.Task_Mode)) || (Value.Status && !KOC.Lodash.includes(Value.Status, ThisValue.Status)));//将获取徽章的任务放在任务表中，但是不显示在前端的任务列表里
                    });
                }
                //将获取徽章的任务放在任务表中，但是不显示在前端的任务列表里
                KOC.Lodash.remove(retValue.returnObject, function (ThisValue) {
                    return ((ThisValue.Task_ID >= 2000));
                });
                // 排序
                if (retValue.returnObject.length > 0) {
                    KOC.Lodash.sortBy(retValue.returnObject, function (ThisValue) {
                        var _SortValue = ThisValue.Task_ID;
                        switch (ThisValue.Status) {
                            case 0: // 已领取
                                _SortValue += 300000;
                                break;
                            case 1: // 执行中
                                _SortValue += 200000;
                                break;
                            case 2: // 已完成
                                _SortValue += 100000;
                                break;
                        }
                        switch (ThisValue.Task_Mode) {
                            case "ONE":
                                _SortValue += 10000;
                                break;
                            case "DAY":
                                _SortValue += 20000;
                                break;
                            case "WEEK":
                                _SortValue += 30000;
                                break;
                            case "MONTH":
                                _SortValue += 40000;
                                break;
                            case "YEAR":
                                _SortValue += 50000;
                                break;
                        }
                        return _SortValue;
                    });
                }
                callback(retValue);
            });
        },
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `user_task`" +
                "(`User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `Task_ID`" +
                ", `Task_Date`" +
                ", `Task_Name`" +
                ", `Task_Mode`" +
                ", `Task_Objective`" +
                ", `Task_Reward`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :Task_ID" +
                ", :Task_Date" +
                ", :Task_Name" +
                ", :Task_Mode" +
                ", :Task_Objective" +
                ", :Task_Reward" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_NickName: null,
                User_RealName: null,
                Task_ID: null,
                Task_Name: null,
                Task_Mode: null,
                Task_Objective: null,
                Task_Reward: null,
                Create_IP: null
            }, Value);
            Value.Task_Objective = KOC.StringUtils.ToInt(Value.Task_Objective);
            if (Value.Task_Objective <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Task_Objective"
                }));
                return;
            }
            switch (Value.Task_Mode) {
                case "ONE":
                    Value.Task_Date = "";
                    break;
                case "DAY":
                    Value.Task_Date = KOC.Moment().format("YYYYMMDD");
                    break;
                case "WEEK":
                    Value.Task_Date = KOC.Moment().startOf("isoWeek").format("YYYYMMDD");
                    break;
                case "MONTH":
                    Value.Task_Date = KOC.Moment().startOf("month").format("YYYYMMDD");
                    break;
                case "YEAR":
                    Value.Task_Date = KOC.Moment().startOf("year").format("YYYYMMDD");
                    break;
                default:
                    callback(KOC.ReturnValue.New({
                        hasError: true,
                        message: "传入参数错误:Task_Mode"
                    }));
                    return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Update: function (Value, callback) {
            var sql = "UPDATE `user_task`" +
                " SET `Task_Progress` = CASE WHEN `Task_Progress` + :Task_Progress >= `Task_Objective` THEN `Task_Objective` ELSE `Task_Progress` + :Task_Progress END" +
                ", `Completion_Date` = CASE WHEN `Task_Progress` >= `Task_Objective` THEN NOW() ELSE `Completion_Date` END" +
                ", `Status` = CASE WHEN `Task_Progress` >= `Task_Objective` THEN 2 ELSE `Status` END" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Task_ID` = :Task_ID" +
                " AND `Task_Date` = :Task_Date" +
                " AND `Task_Mode` = :Task_Mode" +
                " AND `Status` = 1" +
                " AND :Task_Progress > 0" +
                " AND ROUND(:Task_Progress) = :Task_Progress;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Task_ID: null,
                Task_Mode: null,
                Task_Progress: null
            }, Value);
            switch (Value.Task_Mode) {
                case "ONE":
                    Value.Task_Date = "";
                    break;
                case "DAY":
                    Value.Task_Date = KOC.Moment().format("YYYYMMDD");
                    break;
                case "WEEK":
                    Value.Task_Date = KOC.Moment().startOf("isoWeek").format("YYYYMMDD");
                    break;
                case "MONTH":
                    Value.Task_Date = KOC.Moment().startOf("month").format("YYYYMMDD");
                    break;
                case "YEAR":
                    Value.Task_Date = KOC.Moment().startOf("year").format("YYYYMMDD");
                    break;
                default:
                    callback(KOC.ReturnValue.New({
                        hasError: true,
                        message: "传入参数错误:Task_Mode"
                    }));
                    return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback, [this.CacheParm.Info(Value.User_ID, Value.Task_ID, Value.Task_Mode, Value.Task_Date), this.CacheParm.List(Value.User_ID)]);
        },
        Update_Receive: function (Conn, Value, callback) {
            var sql = "UPDATE `user_task`" +
                " SET `Status` = 0" +
                " WHERE `User_ID` = :User_ID" +
                " AND `Task_ID` = :Task_ID" +
                " AND `Task_Date` = :Task_Date" +
                " AND `Task_Mode` = :Task_Mode" +
                " AND `Status` = 2;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Task_ID: null,
                Task_Mode: null,
                Task_Date: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, [this.CacheParm.Info(Value.User_ID, Value.Task_ID, Value.Task_Mode, Value.Task_Date), this.CacheParm.List(Value.User_ID)]);
        },
        Update_Scheduler: function (callback) {
            // var sql = "UPDATE `user_contribution`" +
            //     " SET `Coin_Day` = 0" +
            //     ", `Coin_Week` = CASE DAYOFWEEK(NOW()) WHEN 2 THEN 0 ELSE `Coin_Week` END" + //每周一凌晨
            //     ", `Coin_Month` = CASE DAYOFMONTH(NOW()) WHEN 1 THEN 0 ELSE `Coin_Month` END" +
            //     ", `Coin_Year` = CASE DAYOFYEAR(NOW()) WHEN 1 THEN 0 ELSE `Coin_Year` END";
            // Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
            callback(KOC.ReturnValue.New());
        },
        CacheParm: {
            Info: function (User_ID, Task_ID, Task_Mode, Task_Date) {
                if (Task_Date == undefined) {
                    switch (Task_Mode) {
                        case "ONE":
                            Task_Date = "";
                            break;
                        case "DAY":
                            Task_Date = KOC.Moment().format("YYYYMMDD");
                            break;
                        case "WEEK":
                            Task_Date = KOC.Moment().startOf("isoWeek").format("YYYYMMDD");
                            break;
                        case "MONTH":
                            Task_Date = KOC.Moment().startOf("month").format("YYYYMMDD");
                            break;
                        case "YEAR":
                            Task_Date = KOC.Moment().startOf("year").format("YYYYMMDD");
                            break;
                    }
                }
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_task`" +
                    " WHERE `User_ID` = :User_ID" +
                    " AND `Task_ID` = :Task_ID" +
                    " AND `Task_Mode` = :Task_Mode" +
                    " AND `Task_Date` = :Task_Date" +
                    " LIMIT 1;",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID),
                        Task_ID: KOC.StringUtils.ToIntPositive(Task_ID),
                        Task_Mode: Task_Mode,
                        Task_Date: Task_Date
                    }
                };
            },
            List: function (User_ID) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `user_task`" +
                    " WHERE `User_ID` = :User_ID" +
                    " AND (" +
                    "   `Status` IN (1, 2)" +
                    "   OR (" +
                    "     `Status` = 0 AND (" +
                    "       `Task_Mode` = 'ONE'" +
                    "       OR" +
                    "       (`Task_Mode` = 'DAY' AND `Task_Date` = DATE_FORMAT(CURDATE(),'%Y%m%d'))" +
                    "       OR" +
                    "       (`Task_Mode` = 'WEEK' AND `Task_Date` = DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL WEEKDAY(CURDATE()) DAY),'%Y%m%d'))" +
                    "       OR" +
                    "       (`Task_Mode` = 'MONTH' AND `Task_Date` = DATE_FORMAT(CURDATE(), '%Y%m01'))" +
                    "       OR" +
                    "       (`Task_Mode` = 'YEAR' AND `Task_Date` = DATE_FORMAT(CURDATE(), '%Y0101'))" +
                    "     )" +
                    "   )" +
                    " );",
                    Parm: {
                        User_ID: KOC.StringUtils.ToIntPositive(User_ID)
                    }
                };
            }
        }
    },
    //endregion
    //region User_Contribution:用户贡献表
    User_Contribution: {
        List: function (Value, callback) {
            Value = KOC.Lodash.extend({
                TopN: null,
                User_ID: null,
                User_ID_Contribution: null,
                OrderBy: null
            }, Value);
            if ((!Value.User_ID || Value.User_ID <= 0) && (!Value.User_ID_Contribution || Value.User_ID_Contribution <= 0)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:User_ID"
                }));
                return;
            }
            var sql = "";
            if (Value.User_ID && Value.User_ID > 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_contribution`.`User_ID` = :User_ID", "AND");
            }
            if (Value.User_ID_Contribution && Value.User_ID_Contribution > 0) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`user_contribution`.`User_ID_Contribution` = :User_ID_Contribution", "AND");
            }
            switch (Value.OrderBy) {
                case "Live":
                case "Day":
                case "Week":
                case "Month":
                case "Year":
                    sql = Mysql_Helper.AddToWhereSQL(sql, "`user_contribution`.`Coin_" + Value.OrderBy + "` > 0", "AND");
                    Value.OrderBy = "`user_contribution`.`Coin_" + Value.OrderBy + "` DESC, `user_contribution`.`Create_Date` ASC";
                    break;
                default:
                    Value.OrderBy = "`user_contribution`.`Coin` DESC, `Create_Date` ASC";
                    break;
            }
            sql = "SELECT `user_contribution`.*" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`EXP`" +
                ", CASE WHEN `user_info`.`VIP` = 1 AND `user_info`.`VIP_Expire` >= NOW() THEN 1 ELSE 0 END AS `VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                " FROM `user_contribution` JOIN `user_info`" +
                " ON `user_contribution`.`User_ID` = `user_info`.`User_ID`" + (sql ? " WHERE " + sql : "") +
                " ORDER BY " + Value.OrderBy;
            if (Value.TopN > 0) {
                sql += " LIMIT " + Value.TopN;
            }
            sql += ";";
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_contribution`" +
                " (`User_ID`" +
                ", `User_ID_Contribution`" +
                ", `Coin`" +
                ", `Coin_Live`" +
                ", `Coin_Day`" +
                ", `Coin_Week`" +
                ", `Coin_Month`" +
                ", `Coin_Year`" +
                ", `Create_Date`)" +
                " VALUES (:User_ID" +
                ", :User_ID_Contribution" +
                ", :Coin" +
                ", CASE :Live WHEN TRUE THEN :Coin ELSE 0 END" +
                ", :Coin" +
                ", :Coin" +
                ", :Coin" +
                ", :Coin" +
                ", NOW());";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Contribution: null,
                Coin: null,
                Live: null
            }, Value);
            if (Value.Coin <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Coin"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update: function (Conn, Value, callback) {
            var sql = "UPDATE `user_contribution`" +
                " SET `Coin` = `Coin` + :Coin" +
                ", `Coin_Live` = `Coin_Live` + CASE :Live WHEN TRUE THEN :Coin ELSE 0 END" +
                ", `Coin_Day` = `Coin_Day` + :Coin" +
                ", `Coin_Week` = `Coin_Week` + :Coin" +
                ", `Coin_Month` = `Coin_Month` + :Coin" +
                ", `Coin_Year` = `Coin_Year` + :Coin" +
                " WHERE `User_ID` = :User_ID" +
                " AND `User_ID_Contribution` = :User_ID_Contribution;";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_ID_Contribution: null,
                Coin: null,
                Live: null
            }, Value);
            if (Value.Coin <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Coin"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update_Live: function (Conn, User_ID, callback) {
            var sql = "UPDATE `user_contribution`" +
                " SET `Coin_Live` = 0" +
                " WHERE `User_ID_Contribution` = :User_ID;";
            Mysql_Helper.ExecuteNonQuery(Conn, sql, {
                User_ID: User_ID
            }, callback);
        },
        Update_Scheduler: function (callback) {
            var sql = "UPDATE `user_contribution`" +
                " SET `Coin_Day` = 0" +
                ", `Coin_Week` = CASE DAYOFWEEK(NOW()) WHEN 2 THEN 0 ELSE `Coin_Week` END" + //每周一凌晨
                ", `Coin_Month` = CASE DAYOFMONTH(NOW()) WHEN 1 THEN 0 ELSE `Coin_Month` END" +
                ", `Coin_Year` = CASE DAYOFYEAR(NOW()) WHEN 1 THEN 0 ELSE `Coin_Year` END";
            Mysql_Helper.ExecuteNonQuery(DBName, sql, null, callback);
        }
    },
    //endregion
    //region User_Report:用户举报表
    //*******************************!!!!!!!改
    User_Report: {
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `user_report`" +
                " (`User_ID`" +
                ", `Anchor_ID`" +
                ", `Type`" +
                ", `Content`" +
                ", `Screenshot`" +
                ", `Status`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:User_ID" +
                ", :Anchor_ID" +
                ", :Type" +
                ", :Content" +
                ", :Screenshot" +
                ", 2" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Anchor_ID: null,
                Type: null,
                Content: null,
                Screenshot: null,
                Create_IP: null
            }, Value);
            if (!KOC.Lodash.includes(["色情信息", "垃圾广告", "人身攻击", "敏感信息", "虚假中奖信息"], Value.Type)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Type"
                }));
                return;
            }
            if (Value.Screenshot) {
                Value.Screenshot = JSON.stringify(Value.Screenshot);
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        }
    },
    //endregion
    //region User_Day_Statistics:用户每日统计单
    //*******************************!!!!!!!改
    User_Day_Statistics: {
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `user_day_statistics`" +
                "(`UV`" +
                ", `Regist_Day_Number`" +
                ", `Registration_Conversion`" +
                ", `Login_Day_User`" +
                ", `Regist_Total_User`" +
                ", `Actrate`" +
                ", `Recharge_Day_User`" +
                ", `Recharge_Day_Coin`" +
                ", `Recharge_Total_User`" +
                ", `Pay_Day_User`" +
                ", `Pay_Day_Coin`" +
                ", `ARPU`" +
                ", `Web_IP_Number`" +
                ", `Create_Date`)" +
                " VALUES ( 0" +
                ", :Regist_Day_Number" +
                ", :Registration_Conversion" +
                ", :Login_Day_User" +
                ", :Regist_Total_User" +
                ", :Actrate" +
                ", :Recharge_Day_User" +
                ", :Recharge_Day_Coin" +
                ", :Recharge_Total_User" +
                ", :Pay_Day_User" +
                ", :Pay_Day_Coin" +
                ", :ARPU" +
                ", :Web_IP_Number" +
                ", NOW());";
            Value = KOC.Lodash.extend({
                UV: null,//独立访客个数（暂时不做）
                Regist_Day_Number: null,//当天新增注册人数
                Registration_Conversion: null,//注册转化率（新增注册人数/独立访客）（暂时不做）
                Login_Day_User: null,//当天登录人数
                Regist_Total_User: null,//累计注册人数
                Actrate: null,//活跃率（登录的注册用户/总注册人数）
                Recharge_Day_User: null,//当天充值人数
                Recharge_Day_Coin: null,//当天充值金额
                Recharge_Total_User: null,//累计充值总人数
                Pay_Day_User: null,//当天消费人数
                Pay_Day_Coin: null,//当天消费金额
                ARPU: null,//ARPU值=当天消费的总金额/消费总人数
                Web_IP_Number: null//外网ip的数量
            }, Value);
            Value.UV = 0;
            Value.Registration_Conversion = 0;
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        }
    },
    //endregion
    //region User_FeedBack:用户意见反馈表单
    //*******************************!!!!!!!改
    User_FeedBack: {
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `user_feedback`" +
                "( `User_ID`" +
                ", `Relate_User_ID`" +
                ", `Relate_NickName`" +
                ", `Type`" +
                ", `QQ`" +
                ", `Message`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES ( :User_ID" +
                ", :Relate_User_ID" +
                ", :Relate_NickName" +
                ", :Type" +
                ", :QQ" +
                ", :Message" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                User_ID: null,
                Relate_User_ID: null,
                Relate_NickName: null,
                Type: null,
                QQ: null,
                Message: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        }
    },
    //endregion
    //region User_ItemGrant:后台发放物品表
    //*******************************!!!!!!!改
    User_ItemGrant: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `user_item_grant`" +
                "( `User_ID`" +
                ", `User_NickName`" +
                ", `Item_Type`" +
                ", `Item_ID`" +
                ", `Item_Name`" +
                ", `Num`" +
                ", `Item_Expire`" +
                ", `Remark`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES ( :User_ID" +
                ", :User_NickName" +
                ", :Item_Type" +
                ", :Item_ID" +
                ", :Item_Name" +
                ", :Num" +
                ", :Item_Expire" +
                ", :Remark" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                User_ID: null,
                User_NickName: null,
                Item_Type: null,
                Item_ID: null,
                Item_Name: null,
                Num: null,
                Item_Expire: null,
                Remark: null,
                Create_IP: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback);
        }
    },
    //endregion
    //region Lottery_Info:抽奖信息表
    Lottery_Info: {
        Update_Proc: function (Conn, Order_No, callback) {
            Mysql_Helper.ExecuteRow(Conn, "CALL `proc_lottery`(:Order_No);", {Order_No: Order_No}, callback);
        },
        //*******************************!!!!!!!改
        Info_CategoryAll: function (Value, callback) {
            var sql = "SELECT `Category`" +
                ", `Category`" +
                ", `Name`" +
                ", `Item_ID`" +
                ", `Item_Type`" +
                ", `Item_Value`" +
                ", `Item_Mode`" +
                ", `Winning_Amt`" +
                ", `Winning_Amt_Virtual`" +
                ", `Inform`" +
                " FROM `lottery_info`" +
                " WHERE `Status` = 0";
            if (Value.Category) {
                sql += " AND `Category` = :Category"
            }
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        }
    },
    //endregion
    //region Lucky_Gift_Info:幸运礼物信息表
    Lucky_Gift_Info: {
        Update_Proc: function (Conn, Order_No, callback) {
            Mysql_Helper.ExecuteRow(Conn, "CALL `proc_gift_lucky`(:Order_No);", {Order_No: Order_No}, callback);
        }
    },
    //endregion
    //region Order_AnchorIntegral:艺人罚分单
    Order_AnchorIntegral: {
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_anchorintegral` WHERE `Order_No` = :Order_No LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion
    //region Order_Withdraw:艺人提现单
    //*******************************!!!!!!!改
    Order_Withdraw: {
        Info: function (Order_No, callback) {
            var sql = "SELECT * FROM `order_withdraw` WHERE `Order_No` = :Order_No LIMIT 1;";
            Mysql_Helper.ExecuteRow(DBName, sql, {Order_No: Order_No}, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_withdraw`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `Money`" +
                ", `Revenue_Money`" +
                ", `Real_Money`" +
                ", `Create_Date`" +
                ", `Status`)" +
                " VALUES ( :Order_No" +
                ", :User_ID" +
                ", :Money" +
                ", :Revenue_Money" +
                ", :Real_Money" +
                ", NOW()" +
                ", 1);";
            Value = KOC.Lodash.extend({
                Order_No: null,//单据号
                User_ID: null,//艺人ID
                Money: null,//申请提现的金额（元）
                Revenue_Money: null,//税收金额（元）
                Real_Money: null//实际收入（元）
            }, Value);
            if (Value.Money <= 0 || Value.Revenue_Money < 0 || Value.Real_Money <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误" + Value
                }));
            }
            Mysql_Helper.ExecuteNonQuery(Conn ? Conn : DBName, sql, Value, callback);
        },
        Update_Status: function (Value, callback) {
            var sql = "Update `order_withdraw` " +
                "SET `Status` = :Status_After" +
                ", `Update_Date` = NOW()" +
                " WHERE `Order_No` = :Order_No" +
                " AND `Status` = :Status_Before";
            Value = KOC.Lodash.extend({
                Status: null,
                Order_No: null
            }, Value);
            if (Value.Status) {
                Value.Status_Before = 1;
                Value.Status_After = 0;
            } else {
                Value.Status_Before = 0;
                Value.Status_After = 1;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        }
    },
    //endregion
    //region Order_Guardian:守护购买单
    Order_Guardian: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_guardian`" +
                "(`Order_No`" +
                ", `Live_Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `User_ID_Guardian`" +
                ", `User_NickName_Guardian`" +
                ", `User_RealName_Guardian`" +
                ", `Family_ID`" +
                ", `Family_Name`" +
                ", `Guardian_ID`" +
                ", `Guardian_Name`" +
                ", `Guardian_Mode`" +
                ", `Guardian_Value`" +
                ", `Commission_Guardian_Family`" +
                ", `Commission_Guardian_Anchor`" +
                ", `Commission_Anchor_Family`" +
                ", `Order_Amt`" +
                ", `Order_Amt_Anchor`" +
                ", `Order_Amt_Family`" +
                ", `Order_Amt_Platform`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Order_No" +
                ", :Live_Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :User_ID_Guardian" +
                ", :User_NickName_Guardian" +
                ", :User_RealName_Guardian" +
                ", :Family_ID" +
                ", :Family_Name" +
                ", :Guardian_ID" +
                ", :Guardian_Name" +
                ", :Guardian_Mode" +
                ", CASE WHEN :Guardian_Value > 0 AND ROUND(:Guardian_Value) = :Guardian_Value THEN :Guardian_Value ELSE NULL END" +
                ", CASE WHEN :Commission_Guardian_Family >= 0 AND ROUND(:Commission_Guardian_Family, 2) = :Commission_Guardian_Family THEN :Commission_Guardian_Family ELSE NULL END" +
                ", CASE WHEN :Commission_Guardian_Anchor >= 0 AND ROUND(:Commission_Guardian_Anchor, 2) = :Commission_Guardian_Anchor THEN :Commission_Guardian_Anchor ELSE NULL END" +
                ", CASE WHEN :Commission_Anchor_Family >= 0 AND :Commission_Anchor_Family <= 1 THEN :Commission_Anchor_Family ELSE NULL END" +
                ", CASE WHEN :Order_Amt > 0 AND ROUND(:Order_Amt) = :Order_Amt THEN :Order_Amt ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Anchor >= 0 AND ROUND(:Order_Amt_Anchor) = :Order_Amt_Anchor THEN :Order_Amt_Anchor ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Family >= 0 AND ROUND(:Order_Amt_Family) = :Order_Amt_Family THEN :Order_Amt_Family ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Platform >= 0 AND ROUND(:Order_Amt_Platform) = :Order_Amt_Platform THEN :Order_Amt_Platform ELSE NULL END" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,
                Live_Order_No: null,
                User_ID: null,
                User_NickName: null,
                User_RealName: null,
                User_ID_Guardian: null,
                User_NickName_Guardian: null,
                User_RealName_Guardian: null,
                Family_ID: null,
                Family_Name: null,
                Guardian_ID: null,
                Guardian_Name: null,
                Guardian_Mode: null,
                Guardian_Value: null,
                Commission_Guardian_Family: null,
                Commission_Guardian_Anchor: null,
                Commission_Anchor_Family: null,
                Order_Amt: null,
                Order_Amt_Anchor: null,
                Order_Amt_Family: null,
                Order_Amt_Platform: null,
                Create_IP: null
            }, Value);
            if (!KOC.Lodash.includes(["YEAR", "MONTH", "WEEK", "DAY"], Value.Guardian_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Guardian_Mode"
                }));
                return;
            }
            if (Value.Commission_Guardian_Family + Value.Commission_Guardian_Anchor > 1) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Commission"
                }));
                return;
            }
            if (Value.Order_Amt != (Value.Order_Amt_Anchor + Value.Order_Amt_Family + Value.Order_Amt_Platform)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_Amt"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        //*******************************!!!!!!!改
        Info_PayMoneyDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(`Create_Date`, :formate) AS `Create_Date`" +
                ", SUM(`Order_Amt`) AS Amt_Count" +
                " FROM `order_guardian`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        //*******************************!!!!!!!改
        Info_UserCountDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(`Create_Date`, :formate) AS `Create_Date`" +
                ", COUNT(DISTINCT `User_ID`) AS `User_Count`" +
                " FROM `order_guardian`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        //*******************************!!!!!!!改
        Info_FamilyMonth: function (callback) {
            var sql = "SELECT SUM(`Order_Amt_Anchor`) AS `Sum_Amt_Anchor`" +
                ", `Family_ID`" +
                " FROM `order_guardian`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate)" +
                " GROUP BY `Family_ID`;";
            var Value = {
                formate: '%Y-%c'
            };
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_guardian` WHERE `Order_No` = :Order_No LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion
    //region Order_VIP:VIP购买单
    Order_VIP: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_vip`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `VIP_ID`" +
                ", `VIP_Name`" +
                ", `VIP_Mode`" +
                ", `VIP_Value`" +
                ", `Order_Amt`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUE (:Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :VIP_ID" +
                ", :VIP_Name" +
                ", :VIP_Mode" +
                ", CASE WHEN :VIP_Value > 0 AND ROUND(:VIP_Value) = :VIP_Value THEN :VIP_Value ELSE NULL END" +
                ", CASE WHEN :Order_Amt > 0 AND ROUND(:Order_Amt) = :Order_Amt THEN :Order_Amt ELSE NULL END" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                User_NickName: null,
                User_RealName: null,
                VIP_ID: null,
                VIP_Name: null,
                VIP_Mode: null,
                VIP_Value: null,
                Order_Amt: null,
                Create_IP: null
            }, Value);
            if (!KOC.Lodash.includes(["YEAR", "MONTH", "WEEK", "DAY"], Value.VIP_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:VIP_Mode"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        //*******************************!!!!!!!改
        Info_PayMoneyDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(`Create_Date`, :formate) AS `Create_Date`" +
                ", SUM(`Order_Amt`) AS Amt_Count" +
                " FROM `order_vip`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        //*******************************!!!!!!!改
        Info_UserCountDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(`Create_Date`, :formate) AS `Create_Date`" +
                ", COUNT(DISTINCT `User_ID`) AS `User_Count`" +
                " FROM `order_vip`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_vip` WHERE `Order_No` = :Order_No LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion
    //region Order_Mounts:座骑购买单
    Order_Mounts: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_mounts`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `Mounts_ID`" +
                ", `Mounts_Name`" +
                ", `Mounts_Mode`" +
                ", `Mounts_Value`" +
                ", `Mounts_Price`" +
                ", `Order_Num`" +
                ", `Order_Amt`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :Mounts_ID" +
                ", :Mounts_Name" +
                ", :Mounts_Mode" +
                ", CASE WHEN :Mounts_Value > 0 AND ROUND(:Mounts_Value) = :Mounts_Value THEN :Mounts_Value ELSE NULL END" +
                ", CASE WHEN :Mounts_Price > 0 AND ROUND(:Mounts_Price) = :Mounts_Price THEN :Mounts_Price ELSE NULL END" +
                ", CASE WHEN :Order_Num > 0 AND ROUND(:Order_Num) = :Order_Num THEN :Order_Num ELSE NULL END" +
                ", CASE WHEN :Order_Amt > 0 AND ROUND(:Order_Amt) = :Order_Amt THEN :Order_Amt ELSE NULL END" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                User_NickName: null,
                User_RealName: null,
                Mounts_ID: null,
                Mounts_Name: null,
                Mounts_Mode: null,
                Mounts_Value: null,
                Mounts_Price: null,
                Order_Num: null,
                Order_Amt: null,
                Create_IP: null
            }, Value);
            if (!KOC.Lodash.includes(["YEAR", "MONTH", "WEEK", "DAY"], Value.Mounts_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Mounts_Mode"
                }));
                return;
            }
            if (Value.Order_Amt != (Value.Mounts_Price * Value.Order_Num)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_Amt"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        //*******************************!!!!!!!改
        Info_PayMoneyDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(`Create_Date`, :formate) AS `Create_Date`" +
                ", SUM(`Order_Amt`) AS Amt_Count" +
                " FROM `order_mounts`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        //*******************************!!!!!!!改
        Info_UserCountDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(`Create_Date`, :formate) AS `Create_Date`" +
                ", COUNT(DISTINCT `User_ID`) AS `User_Count`" +
                " FROM `order_mounts`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_mounts` WHERE `Order_No` = :Order_No LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion
    //region Order_Gift:礼物购买单
    Order_Gift: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_gift`" +
                "(`Order_No`" +
                ", `Live_Order_No`" +
                ", `User_ID_Anchor`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `User_ID_Gift`" +
                ", `User_NickName_Gift`" +
                ", `User_RealName_Gift`" +
                ", `Family_ID`" +
                ", `Family_Name`" +
                ", `Gift_ID`" +
                ", `Gift_Name`" +
                ", `Gift_Price`" +
                ", `Commission_Gift_Family`" +
                ", `Commission_Gift_Anchor`" +
                ", `Commission_Anchor_Family`" +
                ", `Lucky`" +
                ", `Order_Num`" +
                ", `Order_Amt`" +
                ", `Order_Amt_Anchor`" +
                ", `Order_Amt_Family`" +
                ", `Order_Amt_Platform`" +
                ", `PurchaseMode`" +
                ", `IsTask`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Order_No" +
                ", :Live_Order_No" +
                ", :User_ID_Anchor" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :User_ID_Gift" +
                ", :User_NickName_Gift" +
                ", :User_RealName_Gift" +
                ", :Family_ID" +
                ", :Family_Name" +
                ", :Gift_ID" +
                ", :Gift_Name" +
                ", CASE WHEN (:Gift_Price > 0 OR (:Gift_Price = 0 AND :PurchaseMode = 2)) AND ROUND(:Gift_Price) = :Gift_Price THEN :Gift_Price ELSE NULL END" +
                ", :Commission_Gift_Family" +
                ", :Commission_Gift_Anchor" +
                ", :Commission_Anchor_Family" +
                ", :Lucky" +
                ", CASE WHEN :Order_Num > 0 AND ROUND(:Order_Num) = :Order_Num THEN :Order_Num ELSE NULL END" +
                ", CASE WHEN (:Order_Amt > 0 OR (:Order_Amt = 0 AND :PurchaseMode = 2)) AND ROUND(:Order_Amt) = :Order_Amt THEN :Order_Amt ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Anchor >= 0 AND ROUND(:Order_Amt_Anchor) = :Order_Amt_Anchor THEN :Order_Amt_Anchor ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Family >= 0 AND ROUND(:Order_Amt_Family) = :Order_Amt_Family THEN :Order_Amt_Family ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Platform >= 0 AND ROUND(:Order_Amt_Platform) = :Order_Amt_Platform THEN :Order_Amt_Platform ELSE NULL END" +
                ", :PurchaseMode" +
                ", :IsTask" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,
                Live_Order_No: null,
                User_ID_Anchor: null,
                User_ID: null,
                User_NickName: null,
                User_RealName: null,
                User_ID_Gift: null,
                User_NickName_Gift: null,
                User_RealName_Gift: null,
                Family_ID: null,
                Family_Name: null,
                Gift_ID: null,
                Gift_Name: null,
                Gift_Price: null,
                Commission_Gift_Family: null,
                Commission_Gift_Anchor: null,
                Commission_Anchor_Family: null,
                Lucky: null,
                Order_Num: null,
                Order_Amt: null,
                Order_Amt_Anchor: null,
                Order_Amt_Family: null,
                Order_Amt_Platform: null,
                PurchaseMode: null,
                IsTask: null,
                Create_IP: null
            }, Value);
            if (Value.Order_Amt != (Value.Gift_Price * Value.Order_Num)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_Amt"
                }));
                return;
            }
            if (Value.Order_Amt != (Value.Order_Amt_Anchor + Value.Order_Amt_Family + Value.Order_Amt_Platform)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_Amt"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.PurchaseMode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:PurchaseMode"
                }));
                return;
            }
            if (!KOC.Lodash.includes([false, true], Value.IsTask)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:IsTask"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        List_GroupGiftUser: function (Value, callback) {
            Value = KOC.Lodash.extend({
                Cache: null, //默认不缓存
                Limit: null, //-1:不限
                GroupType: null, //R:接收人 G:送出人 A:艺人(房间)
                Gift_ID: null, //-1:所有
                User_ID: null, //-1:所有(送出人)
                User_ID_Gift: null, //-1:所有(接收人)
                User_ID_Anchor: null, //-1:所有(艺人)
                Create_Date_Start: null, //null:不限
                Create_Date_End: null //null:不限
            }, Value);
            switch (Value.GroupType) {
                case "G":
                    Value.GroupType = "User_ID";
                    break;
                case "R":
                    Value.GroupType = "User_ID_Gift";
                    break;
                case "A":
                    Value.GroupType = "User_ID_Anchor";
                    break;
                default:
                    callback(KOC.ReturnValue.New({
                        hasError: true,
                        message: "传入参数错误[GroupType]"
                    }));
                    return;
            }
            Value.Limit = KOC.StringUtils.ToIntPositive(Value.Limit);
            Value.Gift_ID = KOC.StringUtils.ToIntPositive(Value.Gift_ID);
            Value.User_ID = KOC.StringUtils.ToIntPositive(Value.User_ID);
            Value.User_ID_Gift = KOC.StringUtils.ToIntPositive(Value.User_ID_Gift);
            Value.User_ID_Anchor = KOC.StringUtils.ToIntPositive(Value.User_ID_Anchor);
            var sql = "";
            if (Value.Gift_ID) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`Gift_ID` = :Gift_ID", "AND");
            }
            if (Value.User_ID) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`User_ID` = :User_ID", "AND");
            }
            if (Value.User_ID_Gift) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`User_ID_Gift` = :User_ID_Gift", "AND");
            }
            if (Value.User_ID_Anchor) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`User_ID_Anchor` = :User_ID_Anchor", "AND");
            }
            if (Value.Create_Date_Start) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`Create_Date` >= :Create_Date_Start", "AND");
            }
            if (Value.Create_Date_End) {
                sql = Mysql_Helper.AddToWhereSQL(sql, "`Create_Date` <= :Create_Date_End", "AND");
            }
            sql = "SELECT `" + Value.GroupType + "` AS `User_ID`" +
                ", `Gift_ID`" +
                ", COUNT(`Order_No`) AS `Count`" +
                ", SUM(`Order_Num`) AS `Num`" +
                ", SUM(`Order_Amt`) AS `Amt`" +
                ", SUM(`Order_Amt_Anchor`) AS `Amt_Anchor`" +
                ", SUM(`Order_Amt_Platform`) AS `Amt_Platform`" +
                ", SUM(`Order_Amt_Family`) AS `Amt_Family`" +
                ", SUM(`LuckyCoin`) AS `LuckyCoin`" +
                ", MAX(`Order_No`) AS `OrderMAX`" +
                " FROM `order_gift`" +
                " WHERE" + sql +
                " GROUP BY `Gift_ID`, `" + Value.GroupType + "`" +
                " ORDER BY `Gift_ID`, `Order_Num` DESC, `OrderMAX`"
                + (Value.Limit ? " LIMIT :Limit" : "");
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback, Value.Cache);
        },
        //*******************************!!!!!!!改
        Info_PayMoneyDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(`Create_Date`, :formate) AS `Create_Date`" +
                ", SUM(`Order_Amt`) AS Amt_Count" +
                " FROM `order_gift`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        //*******************************!!!!!!!改
        Info_UserCountDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(`Create_Date`, :formate) AS `Create_Date`" +
                ", COUNT(DISTINCT `User_ID`) AS `User_Count`" +
                " FROM `order_gift`" +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        //*******************************!!!!!!!改
        Info_FamilyMonth: function (callback) {
            var sql = "SELECT SUM(`Order_Amt_Anchor`) AS `Sum_Amt_Anchor`" +
                ", `Family_ID`" +
                " FROM `order_gift` JOIN " +
                " WHERE DATE_FORMAT(`Create_Date`, :formate) = DATE_FORMAT(NOW(), :formate)" +
                " GROUP BY `Family_ID`;";
            var Value = {
                formate: '%Y-%c'
            };
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        },
        //*******************************!!!!!!!改
        Info_WeekStarAnchor: function (parm, callback) {
            var sql = "SELECT SUM(CASE WHEN `order_gift`.`User_ID_Gift` = `order_gift`.`User_ID_Anchor` THEN `order_gift`.`Order_Num` ELSE 0 END )AS `SUM_Number`" +
                ", `order_gift`.`Gift_ID`" +
                ", `order_gift`.`Gift_Name`" +
                ", `order_gift`.`User_ID_Anchor` AS User_ID" +
                ", `order_gift`.`User_NickName_Gift`" +
                ", `order_gift`.`Create_Date`" +
                ", `user_anchor`.EXP" +
                ", `user_anchor`.`Live`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", IFNULL(`order_live`.`IsMobile`, 0) AS `Live_IsMobile`" +
                " FROM (SELECT * FROM `order_gift`" +
                " WHERE `order_gift`.`Gift_ID` = :Gift_ID" +
                " AND `order_gift`.`Create_Date` >= :Create_Date_Between" +
                " AND `order_gift`.`Create_Date` <= :Create_Date_And" +
                " ORDER BY `Create_Date` DESC)" +
                " AS `order_gift` JOIN `user_anchor` ON `order_gift`.`User_ID_Anchor` = `user_anchor`.`User_ID`" +
                " LEFT JOIN `user_info` ON `order_gift`.`User_ID_Anchor` = `user_info`.`User_ID`" +
                " LEFT JOIN `order_live` ON `user_anchor`.`Live_Order_No` = `order_live`.`Order_No`" +
                " GROUP BY `order_gift`.`Gift_ID`, `order_gift`.`User_ID_Anchor` ORDER BY `SUM_Number` DESC,`Create_Date` ASC LIMIT 0,:Length;";
            var Value = {
                Gift_ID: parm.Gift_ID,
                Length: parm.Length,
                Create_Date_Between: parm.Create_Date_Between,
                Create_Date_And: parm.Create_Date_And
            };
            Mysql_Helper.ExecuteTableCache(DBName, sql, Value, callback);
        },
        //*******************************!!!!!!!改
        Info_WeekStarFans: function (parm, callback) {
            var sql = "SELECT SUM(CASE WHEN `order_gift`.`User_ID_Gift` = `order_gift`.`User_ID_Anchor` THEN `order_gift`.`Order_Num` ELSE 0 END )AS `SUM_Number`" +
                ", `order_gift`.`Gift_ID`" +
                ", `order_gift`.`Gift_Name`" +
                ", `order_gift`.`User_ID_Anchor`" +
                ", `order_gift`.`User_ID`" +
                ", `order_gift`.`User_NickName`" +
                ", `order_gift`.`Create_Date`" +
                ", `user_info`.EXP" +
                ", `user_info`.NickName" +
                ", `user_info`.RealName" +
                " FROM (SELECT * FROM `order_gift`" +
                " WHERE `order_gift`.`Gift_ID` = :Gift_ID " +
                " AND `order_gift`.`Create_Date` >= :Create_Date_Between" +
                " AND `order_gift`.`Create_Date` <= :Create_Date_And" +
                " ORDER BY `Create_Date` DESC)" +
                " AS `order_gift` JOIN `user_info` ON `order_gift`.`User_ID` = `user_info`.`User_ID`" +
                " GROUP BY `order_gift`.`Gift_ID`, `order_gift`.`User_ID` ORDER BY `SUM_Number` DESC, `Create_Date` ASC LIMIT 0,:Length;";
            var Value = {
                Gift_ID: parm.Gift_ID,
                Length: parm.Length,
                Create_Date_Between: parm.Create_Date_Between,
                Create_Date_And: parm.Create_Date_And
            };
            Mysql_Helper.ExecuteTableCache(DBName, sql, Value, callback);
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_gift` WHERE `Order_No` = :Order_No LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion
    //region Order_Horn:喇叭购买单
    Order_Horn: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_horn`" +
                "(`Order_No`" +
                ", `Live_Order_No`" +
                ", `Horn_Mode`" +
                ", `Horn_Message`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `User_ID_Anchor`" +
                ", `User_NickName_Anchor`" +
                ", `User_RealName_Anchor`" +
                ", `Family_ID`" +
                ", `Family_Name`" +
                ", `Commission_Horn_Family`" +
                ", `Commission_Horn_Anchor`" +
                ", `Commission_Anchor_Family`" +
                ", `Order_Amt`" +
                ", `Order_Amt_Anchor`" +
                ", `Order_Amt_Family`" +
                ", `Order_Amt_Platform`" +
                ", `PurchaseMode`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Order_No" +
                ", :Live_Order_No" +
                ", :Horn_Mode" +
                ", :Horn_Message" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :User_ID_Anchor" +
                ", :User_NickName_Anchor" +
                ", :User_RealName_Anchor" +
                ", :Family_ID" +
                ", :Family_Name" +
                ", :Commission_Horn_Family" +
                ", :Commission_Horn_Anchor" +
                ", :Commission_Anchor_Family" +
                ", CASE WHEN :Order_Amt > 0 AND ROUND(:Order_Amt) = :Order_Amt THEN :Order_Amt ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Anchor >= 0 AND ROUND(:Order_Amt_Anchor) = :Order_Amt_Anchor THEN :Order_Amt_Anchor ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Family >= 0 AND ROUND(:Order_Amt_Family) = :Order_Amt_Family THEN :Order_Amt_Family ELSE NULL END" +
                ", CASE WHEN :Order_Amt_Platform >= 0 AND ROUND(:Order_Amt_Platform) = :Order_Amt_Platform THEN :Order_Amt_Platform ELSE NULL END" +
                ", :PurchaseMode" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,
                Live_Order_No: null,
                Horn_Mode: null,
                Horn_Message: null,
                User_ID: null,
                User_NickName: null,
                User_RealName: null,
                User_ID_Anchor: null,
                User_NickName_Anchor: null,
                User_RealName_Anchor: null,
                Family_ID: null,
                Family_Name: null,
                Commission_Horn_Family: null,
                Commission_Horn_Anchor: null,
                Commission_Anchor_Family: null,
                Order_Amt: null,
                Order_Amt_Anchor: null,
                Order_Amt_Family: null,
                Order_Amt_Platform: null,
                PurchaseMode: null,
                Create_IP: null
            }, Value);
            if (!KOC.Lodash.includes(["ROOM", "SERVER"], Value.Horn_Mode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Horn_Mode"
                }));
                return;
            }
            if (Value.Order_Amt != (Value.Order_Amt_Anchor + Value.Order_Amt_Family + Value.Order_Amt_Platform)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_Amt"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.PurchaseMode)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:PurchaseMode"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_horn` WHERE `Order_No` = :Order_No LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion
    //region Order_Pond:房间爆奖单
    Order_Pond: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_pond`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `Family_ID`" +
                ", `Family_Name`" +
                ", `Live_Order_No`" +
                ", `Order_Num`" +
                ", `Order_Amt`" +
                ", `Detail`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :Family_ID" +
                ", :Family_Name" +
                ", :Live_Order_No" +
                ", :Order_Num" +
                ", :Order_Amt" +
                ", :Detail" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                User_NickName: null,
                User_RealName: null,
                Family_ID: null,
                Family_Name: null,
                Live_Order_No: null,
                Order_Num: null,
                Order_Amt: null,
                Detail: null,
                Create_IP: null
            }, Value);
            Value.Order_Num = KOC.StringUtils.ToIntPositive(Value.Order_Num);
            Value.Order_Amt = KOC.StringUtils.ToIntPositive(Value.Order_Amt);
            Value.Family_Name = KOC.StringUtils.ToString(Value.Family_Name);
            if (!Value.Order_Amt) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_Amt"
                }));
                return;
            }
            if (!Value.Order_Num) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_Num"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_pond` WHERE `Order_No` = :Order_No LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion
    //region Order_Live:艺人开播单
    Order_Live: {
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        //*******************************!!!!!!!改
        Info_FirstLive: function (User_ID, callback) {
            var sql = "SELECT * FROM `order_live` WHERE User_ID = :User_ID ORDER BY Create_Date ASC LIMIT 1";
            Mysql_Helper.ExecuteRow(DBName, sql, {User_ID: User_ID}, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_live`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `Family_ID`" +
                ", `Family_Name`" +
                ", `IsMobile`" +
                ", `Mode`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :Family_ID" +
                ", :Family_Name" +
                ", :IsMobile" +
                ", :Mode" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                User_NickName: null,
                User_RealName: null,
                Family_ID: null,
                Family_Name: null,
                IsMobile: null,
                Mode: null,
                Create_IP: null
            }, Value);
            Value.IsMobile = Value.IsMobile ? 1 : 0;
            //传入参数检验
            if (!Value.Order_No) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_No"
                }));
                return;
            }
            //参数正确 插入表
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        },
        Update_End: function (Conn, Value, callback) {
            var sql = "UPDATE `order_live`" +
                " SET `Duration` = TIMESTAMPDIFF(MINUTE, `Create_Date`, NOW())" +
                ", `End_Date` = NOW()" +
                ", `Status` = 0" +
                " WHERE `Order_No` = :Order_No" +
                " AND `User_ID` = :User_ID" +
                " AND `Status` = 1;";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Order_No));
        },
        Update_Gift: function (Conn, Value, callback) {
            var sql = "UPDATE `order_live`" +
                " SET `Coin` = `Coin` + :Gift_Coin" +
                ", `Beans_Anchor` = `Beans_Anchor` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN :Gift_Beans_User ELSE 0 END" +
                ", `Beans_Family` = `Beans_Family` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN :Gift_Beans_Family ELSE 0 END" +
                ", `Beans_User` = `Beans_User` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN 0 ELSE :Gift_Beans_User END" +
                ", `Beans_UserFamily` = `Beans_UserFamily` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN 0 ELSE :Gift_Beans_Family END" +
                ", `Beans_Platform` = `Beans_Platform` + :Gift_Beans_Platform" +
                ", `Gift_Num` = `Gift_Num` + :Gift_Num" +
                ", `Gift_Num_Anchor` = `Gift_Num_Anchor` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN :Gift_Num ELSE 0 END" +
                ", `Gift_Num_User` = `Gift_Num_User` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN 0 ELSE :Gift_Num END" +
                ", `Gift_Count` = `Gift_Count` + 1" +
                ", `Gift_Count_Anchor` = `Gift_Count_Anchor` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN 1 ELSE 0 END" +
                ", `Gift_Count_User` = `Gift_Count_User` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN 0 ELSE 1 END" +
                ", `Gift_Coin` = `Gift_Coin` + :Gift_Coin" +
                ", `Gift_Coin_Anchor` = `Gift_Coin_Anchor` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN :Gift_Coin ELSE 0 END" +
                ", `Gift_Coin_User` = `Gift_Coin_User` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN 0 ELSE :Gift_Coin END" +
                ", `Gift_Beans_Anchor` = `Gift_Beans_Anchor` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN :Gift_Beans_User ELSE 0 END" +
                ", `Gift_Beans_Family` = `Gift_Beans_Family` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN :Gift_Beans_Family ELSE 0 END" +
                ", `Gift_Beans_User` = `Gift_Beans_User` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN 0 ELSE :Gift_Beans_User END" +
                ", `Gift_Beans_UserFamily` = `Gift_Beans_UserFamily` + CASE :User_ID_Gift WHEN :User_ID_Anchor THEN 0 ELSE :Gift_Beans_Family END" +
                ", `Gift_Beans_Platform` = `Gift_Beans_Platform` + :Gift_Beans_Platform" +
                " WHERE `Order_No` = :Order_No" +
                " AND `User_ID` = :User_ID_Anchor" +
                " AND :Gift_Num > 0" +
                " AND :Gift_Coin >= 0" +
                " AND :Gift_Beans_User >= 0" +
                " AND :Gift_Beans_Family >= 0" +
                " AND :Gift_Beans_Platform >= 0" +
                " AND :Gift_Coin = :Gift_Beans_User + :Gift_Beans_Family + :Gift_Beans_Platform;";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                User_ID_Gift: null,
                User_ID_Anchor: null,
                Gift_Num: null,
                Gift_Coin: null,
                Gift_Beans_User: null,
                Gift_Beans_Family: null,
                Gift_Beans_Platform: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Order_No));
        },
        Update_GiftPond: function (Conn, Value, callback) {
            var sql = "UPDATE `order_live`" +
                " SET `Gift_Pond_Count` = `Gift_Pond_Count` + 1" +
                ", `Gift_Pond_Coin` = `Gift_Pond_Coin` + :Gift_Pond_Coin" +
                " WHERE `Order_No` = :Order_No" +
                " AND `User_ID` = :User_ID" +
                " AND `Gift_Pond_Coin` + :Gift_Pond_Coin <= `Gift_Beans_Platform`;";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                Gift_Pond_Coin: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Order_No));
        },
        Update_Guardian: function (Conn, Value, callback) {
            var sql = "UPDATE `order_live`" +
                " SET `Coin` = `Coin` + :Guardian_Coin" +
                ", `Beans_Anchor` = `Beans_Anchor` + :Guardian_Beans_Anchor" +
                ", `Beans_Family` = `Beans_Family` + :Guardian_Beans_Family" +
                ", `Beans_Platform` = `Beans_Platform` + :Guardian_Beans_Platform" +
                ", `Guardian_Count` = `Guardian_Count` + 1" +
                ", `Guardian_Coin` = `Guardian_Coin` + :Guardian_Coin" +
                ", `Guardian_Beans_Anchor` = `Guardian_Beans_Anchor` + :Guardian_Beans_Anchor" +
                ", `Guardian_Beans_Family` = `Guardian_Beans_Family` + :Guardian_Beans_Family" +
                ", `Guardian_Beans_Platform` = `Guardian_Beans_Platform` + :Guardian_Beans_Platform" +
                " WHERE `Order_No` = :Order_No" +
                " AND `User_ID` = :User_ID" +
                " AND :Guardian_Coin > 0" +
                " AND :Guardian_Beans_Anchor >= 0" +
                " AND :Guardian_Beans_Family >= 0" +
                " AND :Guardian_Beans_Platform >= 0" +
                " AND :Guardian_Coin = :Guardian_Beans_Anchor + :Guardian_Beans_Family + :Guardian_Beans_Platform;";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                Guardian_Coin: null,
                Guardian_Beans_Anchor: null,
                Guardian_Beans_Family: null,
                Guardian_Beans_Platform: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Order_No));
        },
        Update_Horn: function (Conn, Value, callback) {
            var sql = "UPDATE `order_live`" +
                " SET `Coin` = `Coin` + :Horn_Coin" +
                ", `Beans_Anchor` = `Beans_Anchor` + :Horn_Beans_Anchor" +
                ", `Beans_Family` = `Beans_Family` + :Horn_Beans_Family" +
                ", `Beans_Platform` = `Beans_Platform` + :Horn_Beans_Platform" +
                ", `Horn_Count` = `Horn_Count` + 1" +
                ", `Horn_Coin` = `Horn_Coin` + :Horn_Coin" +
                ", `Horn_Beans_Anchor` = `Horn_Beans_Anchor` + :Horn_Beans_Anchor" +
                ", `Horn_Beans_Family` = `Horn_Beans_Family` + :Horn_Beans_Family" +
                ", `Horn_Beans_Platform` = `Horn_Beans_Platform` + :Horn_Beans_Platform" +
                " WHERE `Order_No` = :Order_No" +
                " AND `User_ID` = :User_ID" +
                " AND :Horn_Coin > 0" +
                " AND :Horn_Beans_Anchor >= 0" +
                " AND :Horn_Beans_Family >= 0" +
                " AND :Horn_Beans_Platform >= 0" +
                " AND :Horn_Coin = :Horn_Beans_Anchor + :Horn_Beans_Family + :Horn_Beans_Platform;";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                Horn_Coin: null,
                Horn_Beans_Anchor: null,
                Horn_Beans_Family: null,
                Horn_Beans_Platform: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Order_No));
        },
        Update_Pomelo: function (Conn, Value, callback) {
            var sql = "UPDATE `order_live`" +
                " SET `Pomelo` = `Pomelo` + :Num" +
                " WHERE `Order_No` = :Order_No" +
                " AND `User_ID` = :User_ID" +
                " AND :Num > 0" +
                " AND ROUND(:Num) = :Num;";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                Num: null
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Order_No));
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_live` WHERE `Order_No` = :Order_No LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion,
    //region Order_Pay:充值交易单
    //*******************************!!!!!!!改
    Order_Pay: {
        Info: function (Order_No, callback) {
            var cacheParm = this.CacheParm.Info(Order_No);
            Mysql_Helper.ExecuteRowCache(DBName, cacheParm.SQL, cacheParm.Parm, callback);
        },
        Info_UserCountDay: function (callback) {
            var sql = "SELECT COUNT(DISTINCT `User_ID`) AS `User_Count` FROM `order_pay`" +
                " WHERE `Status` = 0" +
                " AND DATE_FORMAT(NOW(), :formate) = DATE_FORMAT(`Update_Date`, :formate);";
            Mysql_Helper.ExecuteRow(DBName, sql, {formate: '%Y-%c-%d'}, callback);
        },
        Info_UserCountALL: function (callback) {
            var sql = "SELECT COUNT(DISTINCT `User_ID`) AS `User_Count`" +
                " FROM `order_pay` WHERE `Status` = 0;";
            Mysql_Helper.ExecuteRow(DBName, sql, {}, callback);
        },
        Info_MoneyDay: function (callback) {
            var sql = "SELECT DATE_FORMAT(NOW(), '%Y-%c-%d') AS Today" +
                ", CASE WHEN SUM(`Pay_Money`) IS NULL THEN 0 ELSE SUM(`Pay_Money`) END AS `Sum_Money`" +
                " FROM `order_pay` WHERE `Status` = 0" +
                " AND DATE_FORMAT(NOW(), '%Y-%c-%d') = DATE_FORMAT(`Update_Date`, '%Y-%c-%d');";
            Mysql_Helper.ExecuteRow(DBName, sql, {}, callback);
        },
        Info_MoneyALL: function (callback) {
            var sql = "SELECT CASE WHEN SUM(`Pay_Money`) IS NULL THEN 0 ELSE SUM(`Pay_Money`) END AS `Sum_Money`" +
                " FROM `order_pay` WHERE `Status` = 0;";
            Mysql_Helper.ExecuteRow(DBName, sql, {}, callback);
        },
        Info_Channel_Pay: function (Value, callback) {
            var sql = "SELECT `Channel_ID`" +
                ", COUNT( `User_ID`) AS `User_ID_Count`" +//-- 充值人次
                ", COUNT(distinct `User_ID`) AS `User_ID_Number`" +// -- 充值人数
                ", SUM(`Pay_Money`) AS `SUM_Money`" +
                ", SUM(`Pay_Coin`) AS `SUM_Coin`" +
                " FROM `koc-anchor-user`.`order_pay`" +
                " WHERE `Channel_ID` > 0" +
                " AND `Update_Date` >= :Create_Date_Between" +
                " AND `Update_Date` <= :Create_Date_And" +
                " AND `Status` = 0";
            Value = KOC.Lodash.extend({
                Create_Date_Between: null,
                Create_Date_And: null,
                Channel_ID: null
            }, Value);
            if (Value.Channel_ID == -1) {
                sql += " AND `Channel_ID` IN(118060101, 118060102, 118060103, 118060104)";
            } else {
                sql += " AND `Channel_ID` IN(:Channel_ID)";
            }
            sql += " GROUP BY `Channel_ID`" +
                " ORDER BY `Channel_ID` DESC";
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        },
        Insert: function (Value, callback) {
            var sql = "INSERT INTO `order_pay`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `Channel_ID`" +
                ", `Pay_Type`" +
                ", `Pay_Style`" +
                ", `Pay_From`" +
                ", `Pay_Money`" +
                ", `Pay_Coin`" +
                ", `Pay_Poundage`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES (:Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :Channel_ID" +
                ", :Pay_Type" +
                ", :Pay_Style" +
                ", :Pay_From" +
                ", CASE WHEN ROUND(:Pay_Money, 2) = :Pay_Money THEN :Pay_Money ELSE NULL END" +
                ", :Pay_Coin" +
                ", :Pay_Poundage" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                User_NickName: null,
                Channel_ID: null,
                Pay_Type: null,
                Pay_Style: null,
                Pay_From: null,
                Pay_Money: null,
                Pay_Coin: null,
                Pay_Poundage: null,
                Create_IP: null
            }, Value);
            Value.Pay_Type = KOC.StringUtils.ToIntPositive(Value.Pay_Type, -1);
            Value.Pay_From = KOC.StringUtils.ToIntPositive(Value.Pay_From, -1);
            Value.Pay_Money = KOC.StringUtils.ToFloatPositive(Value.Pay_Money, -1);
            Value.Pay_Coin = KOC.StringUtils.ToIntPositive(Value.Pay_Coin);
            Value.Pay_Poundage = KOC.StringUtils.ToIntPositive(Value.Pay_Poundage);
            if (!KOC.Lodash.includes([0, 1, 2], Value.Pay_From)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Pay_From"
                }));
                return;
            }
            if (Value.Pay_Money <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Pay_Money"
                }));
                return;
            }
            if (Value.Pay_Coin <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Pay_Coin"
                }));
                return;
            }
            if (Value.Pay_Poundage < 0 || Value.Pay_Poundage >= Value.Pay_Coin) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Pay_Poundage"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(DBName, sql, Value, callback);
        },
        Update: function (Conn, Value, callback) {
            var sql = "UPDATE `order_pay`" +
                " SET `Status` = 0" +
                " , `Pay_TransNumber` = :Pay_TransNumber" +
                " , `Update_Date` = NOW()" +
                " WHERE `Order_No` = :Order_No" +
                " AND `User_ID` = :User_ID" +
                " AND `Status` = 1" +
                " AND :Pay_TransNumber IS NOT NULL;";
            Value = KOC.Lodash.extend({
                Order_No: null,
                User_ID: null,
                Pay_TransNumber: null
            }, Value);
            if (!Value.Order_No) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Order_No"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback, this.CacheParm.Info(Value.Order_No));
        },
        CacheParm: {
            Info: function (Order_No) {
                return {
                    DB: DBName,
                    SQL: "SELECT * FROM `order_pay`" +
                    " WHERE `Order_No` = :Order_No" +
                    " LIMIT 1;",
                    Parm: {Order_No: Order_No}
                };
            }
        }
    },
    //endregion
    //region Order_BankManage:帐户资金管理表(管理员操作)
    Order_BankManage: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_bankmanage`" +
                "(`Order_No`" +
                ", `Admin_ID`" +
                ", `NickName`" +
                ", `RealName`" +
                ", `Related_Type`" +
                ", `Related_ID`" +
                ", `Related_NickName`" +
                ", `Trade_Flag`" +
                ", `Trade_Currency`" +
                ", `Trade_Amt`" +
                ", `Remark`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES ( :Order_No" +
                ", :Admin_ID" +
                ", :NickName" +
                ", :RealName" +
                ", :Related_Type" +
                ", :Related_ID" +
                ", :Related_NickName" +
                ", :Trade_Flag" +
                ", :Trade_Currency" +
                ", :Trade_Amt" +
                ", :Remark" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,//提现单据号
                Admin_ID: null,//操作用户ID
                NickName: null,//操作用户昵称
                RealName: null,//操作用户真实姓名
                Related_Type: null,//相关类型：1-用户，2-公会
                Related_ID: null,//相关ID（用户ID 或公会ID）
                Related_NickName: null,//相关名称（用户昵称或公会名称）
                Trade_Flag: null,//交易方式  1：入账-1：出账
                Trade_Currency: null,// 交易币种1:金币 2:金豆
                Trade_Amt: null,//交易金额
                Remark: null,//备注
                Create_IP: null//IP地址
            }, Value);
            Value.Trade_Amt = KOC.StringUtils.ToIntPositive(Value.Trade_Amt);
            if (Value.Trade_Amt <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Trade_Amt"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.Related_Type)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Related_Type"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, -1], Value.Trade_Flag)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Trade_Flag"
                }));
                return;
            }
            if (!KOC.Lodash.includes([1, 2], Value.Trade_Currency)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "传入参数错误:Trade_Currency"
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        }
    },
    //endregion
    //region Order_CurrencyExchange:货币兑换表（金豆兑换金币）
    Order_CurrencyExchange: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_currencyexchange`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `NickName`" +
                ", `RealName`" +
                ", `Exchange_Beans`" +
                ", `Exchange_Coin`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES ( :Order_No" +
                ", :User_ID" +
                ", :NickName" +
                ", :RealName" +
                ", :Exchange_Beans" +
                ", :Exchange_Coin" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,//单据号
                User_ID: null,//用户ＩＤ
                NickName: null,//用户昵称
                RealName: null,//用户真实姓名
                Exchange_Beans: null,//兑换的金豆数
                Exchange_Coin: null,//兑换的金币数
                Create_IP: null//IP地址
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        }
    },
    //endregion
    //region Order_Lottery:抽奖单据表
    Order_Lottery: {
        //*******************************!!!!!!!改
        Info_Rank: function (Value, callback) {
            var sql = "SELECT `user_info`.`User_ID`" +
                ", `user_info`.`NickName`" +
                ", SUM(`order_lottery`.`Winning_Amt`) AS `SUM_Winning_Amt`" +
                ", SUM(`order_lottery`.`Winning_Amt_Virtual`) AS `SUM_Winning_Value`" +
                " FROM `order_lottery` JOIN `user_info`" +
                " ON `order_lottery`.`User_ID` = `user_info`.`User_ID`";
            Value = KOC.Lodash.extend({
                Between_Create_Date: null,
                And_Create_Date: null,
                Length: null
            }, Value);
            if (Value.Between_Create_Date && Value.And_Create_Date) {
                sql += "WHERE `order_lottery`.`Create_Date` >= :Between_Create_Date" +
                    " AND `order_lottery`.`Create_Date` < :And_Create_Date";
            }
            sql += " GROUP BY `order_lottery`.`User_ID`" +
                " ORDER BY `SUM_Winning_Value` DESC" +
                " LIMIT :Length";
            Value.Length = KOC.StringUtils.ToIntPositive(Value.Length);
            if (Value.Length <= 0) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "参数错误：" + Value.Length
                }));
                return;
            }
            Mysql_Helper.ExecuteTable(DBName, sql, Value, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_lottery`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `User_ID_Anchor`" +
                ", `Family_ID`" +
                ", `Family_Name`" +
                ", `Order_Amt`" +
                ", `Count`" +
                ", `Category`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES ( :Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :User_ID_Anchor" +
                ", :Family_ID" +
                ", :Family_Name" +
                ", :Order_Amt" +
                ", :Count" +
                ", :Category" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,//单据号
                User_ID: null,//用户ＩＤ
                User_NickName: null,//用户昵称
                User_RealName: null,//用户真实姓名
                User_ID_Anchor: null,//用户ID(艺人，房间)
                Family_ID: null,//公会ID
                Family_Name: null,//公会名称
                Order_Amt: null,//抽奖金额(金币)
                Count: null,//抽奖次数
                Category: null,//抽奖类别
                Create_IP: null//IP地址
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        }
    },
    //endregion
    //region Order_Integral:艺人罚分表单
    Order_Integral: {
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_anchorintegral`" +
                "( `Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `User_ID_Admin`" +
                ", `User_NickName_Admin`" +
                ", `User_RealName_Admin`" +
                ", `Family_ID`" +
                ", `Family_Name`" +
                ", `Integral`" +
                ", `Type`" +
                ", `Operation`" +
                ", `Inform`" +
                ", `Remark`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES ( :Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :User_ID_Admin" +
                ", :User_NickName_Admin" +
                ", :User_RealName_Admin" +
                ", :Family_ID" +
                ", :Family_Name" +
                ", :Integral" +
                ", :Type" +
                ", :Operation" +
                ", :Inform" +
                ", :Remark" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,//单据号
                User_ID: null,//被操作艺人ID
                User_NickName: null,//被操作艺人昵称
                User_RealName: null,//被操作艺人真实姓名
                User_ID_Admin: null,//操作人ID
                User_NickName_Admin: null,//操作人昵称
                User_RealName_Admin: null,//操作人真实姓名
                Family_ID: null,//艺人公会ID
                Family_Name: null,//艺人公会名称
                Integral: null,//罚分
                Type: null,//类型
                Operation: null,//操作类型:-1-警告,1-结束直播,2-冻结房间
                Inform: null,//通知类型:-1-默认不通知,1-通知艺人自己,2-通知房间内所有用户,3-通知全服
                Remark: null,//说明
                Create_IP: null
            }, Value);
            Value.User_ID = KOC.StringUtils.ToIntPositive(Value.User_ID);
            Value.User_ID_Admin = KOC.StringUtils.ToIntPositive(Value.User_ID_Admin);
            Value.Family_ID = KOC.StringUtils.ToInt(Value.Family_ID, -1);
            Value.Integral = KOC.StringUtils.ToIntPositive(Value.Integral);
            Value.Operation = KOC.StringUtils.ToIntPositive(Value.Operation);
            Value.Inform = KOC.StringUtils.ToIntPositive(Value.Inform);
            Value.User_NickName = Value.User_NickName ? Value.User_NickName : "";
            Value.User_RealName = Value.User_RealName ? Value.User_RealName : "";
            Value.User_NickName_Admin = Value.User_NickName_Admin ? Value.User_NickName_Admin : "";
            Value.User_RealName_Admin = Value.User_RealName_Admin ? Value.User_RealName_Admin : "";
            Value.Family_Name = Value.Family_Name ? Value.Family_Name : "";
            if (!Value.User_ID) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "参数错误 User_ID：" + Value.User_ID
                }));
                return;
            }
            if (!Value.User_ID_Admin) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "参数错误 User_ID_Admin：" + Value.User_ID_Admin
                }));
                return;
            }
            if (!KOC.Lodash.includes([0, 1, 2, 3], Value.Inform)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "参数错误 Inform：" + Value.Inform
                }));
                return;
            }
            if (!KOC.Lodash.includes([0, 1, 2], Value.Operation)) {
                callback(KOC.ReturnValue.New({
                    hasError: true,
                    message: "参数错误 Operation：" + Value.Operation
                }));
                return;
            }
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        }
    },
    //endregion
    //region Order_PoundEgg:砸蛋游戏单据表
    Order_PoundEgg: {
        Update_Proc: function (Conn, Order_No, callback) {
            Mysql_Helper.ExecuteRow(Conn, "CALL `proc_poundegg`(:Order_No);", {Order_No: Order_No}, callback);
        },
        Insert: function (Conn, Value, callback) {
            var sql = "INSERT INTO `order_poundegg`" +
                "(`Order_No`" +
                ", `User_ID`" +
                ", `User_NickName`" +
                ", `User_RealName`" +
                ", `User_ID_Anchor`" +
                ", `Family_ID`" +
                ", `Family_Name`" +
                ", `Order_Amt`" +
                ", `Count`" +
                ", `Category`" +
                ", `Create_Date`" +
                ", `Create_IP`)" +
                " VALUES ( :Order_No" +
                ", :User_ID" +
                ", :User_NickName" +
                ", :User_RealName" +
                ", :User_ID_Anchor" +
                ", :Family_ID" +
                ", :Family_Name" +
                ", :Order_Amt" +
                ", :Count" +
                ", :Category" +
                ", NOW()" +
                ", :Create_IP);";
            Value = KOC.Lodash.extend({
                Order_No: null,//单据号
                User_ID: null,//用户ＩＤ
                User_NickName: null,//用户昵称
                User_RealName: null,//用户真实姓名
                User_ID_Anchor: null,//用户ID(艺人，房间)
                Family_ID: null,//公会ID
                Family_Name: null,//公会名称
                Order_Amt: null,//砸蛋游戏金额(金币)
                Count: null,//砸蛋游戏次数
                Category: null,//砸蛋游戏类别
                Create_IP: null//IP地址
            }, Value);
            Mysql_Helper.ExecuteNonQuery(Conn, sql, Value, callback);
        }
    },
    //endregion
    //region Page:分页
    Page: {
        //region UserInfo:用户信息
        UserInfo: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`User_ID`";
            PageParm.ColumnMAX = "`User_ID`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`user_info`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`RealName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Email` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Phone` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`QQ` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.NickName) {
                parm.NickName = "%" + parm.NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`NickName` LIKE :NickName", "AND");
            }
            if (parm.RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`RealName` = :RealName", "AND");
            }
            if (parm.IDCard) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`IDCard` = :IDCard", "AND");
            }
            var _IDCard_Status = [];
            KOC.Lodash.forEach(String(parm.IDCard_Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -100) >= -1) {
                    _Status.push(ThisValue);
                }
            });
            if (_IDCard_Status.length > 0) {
                parm.IDCard_Status = _IDCard_Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`IDCard_Status` IN (:IDCard_Status)", "AND");
            }
            if (parm.Email) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Email` = :Email", "AND");
            }
            if (parm.Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Phone` = :Phone", "AND");
            }
            if (parm.QQ) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`QQ` = :QQ", "AND");
            }
            if (parm.Sex > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Sex` = :Sex", "AND");
            }
            if (parm.Channel_ID) {
                parm.Channel_ID = parm.Channel_ID + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Channel_ID` LIKE :Channel_ID", "AND");
            }
            if (parm.Inviter_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Inviter_ID` = :Inviter_ID", "AND");
            }
            var _SignUp_Origin = [];
            KOC.Lodash.forEach(String(parm.SignUp_Origin).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _SignUp_Origin.push(ThisValue);
                }
            });
            if (_SignUp_Origin.length > 0) {
                parm.SignUp_Origin = _SignUp_Origin;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`SignUp_Origin` IN (:SignUp_Origin)", "AND");
            }
            if (parm.SignUp_Anchor_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`SignUp_Anchor_ID` = :SignUp_Anchor_ID", "AND");
            }
            if (parm.SignUp_Anchor_Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`SignUp_Anchor_Family_ID` = :SignUp_Anchor_Family_ID", "AND");
            }
            if (parm.Charge_First >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Charge_First` = :Charge_First", "AND");
            }
            if (parm.IsVIP == 1) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`VIP` = 1 AND `VIP_Expire` >= NOW()", "AND");
            } else if (parm.IsVIP == 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`VIP` = 0 OR `VIP_Expire` < NOW()", "AND");
            }
            if (parm.IsAnchor >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`IsAnchor` = :IsAnchor", "AND");
            }
            if (parm.IsFamily >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`IsFamily` = :IsFamily", "AND");
            }
            if (parm.IsAdmin >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`IsAdmin` = :IsAdmin", "AND");
            }
            if (parm.OAuth_Phone >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Phone` IS" + (parm.OAuth_Phone ? " NOT" : "") + " NULL", "AND");
            }
            if (parm.OAuth_QQ >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`OAuth_QQ_ID` IS" + (parm.OAuth_QQ ? " NOT" : "") + " NULL", "AND");
            }
            if (parm.OAuth_Weibo >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`OAuth_Weibo_ID` IS" + (parm.OAuth_Weibo ? " NOT" : "") + " NULL", "AND");
            }
            if (parm.OAuth_Weixin >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`OAuth_Weixin_ID` IS" + (parm.OAuth_Weixin ? " NOT" : "") + " NULL", "AND");
            }
            if (KOC.Lodash.includes(["Create_Date", "IDCard_Date", "Charge_First_Date", "Charge_Last_Date"], parm.DateType)) {
                parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
                if (parm.StartDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`" + parm.DateType + "` >= :StartDate", "AND");
                }
                parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
                if (parm.EndDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`" + parm.DateType + "` <= :EndDate", "AND");
                }
            }
            if (parm.Self >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Self` = :Self", "AND");
            }
            var _Status = [];
            KOC.Lodash.forEach(String(parm.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                parm.Status = _Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Status` IN (:Status)", "AND");
            }
            PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Self` = 0", "AND");
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "User_ID",
                        "NickName",
                        "RealName",
                        "Signature",
                        "IDCard",
                        "IDCard_Status",
                        "IDCard_Date",
                        "Account_RealName",
                        "Account_CardNo",
                        "Account_City",
                        "Account_Province",
                        "Account_BankName",
                        "Account_BankFullName",
                        "Email",
                        "Phone",
                        "QQ",
                        "Sex",
                        "Birthday",
                        "Constellation",
                        "Province",
                        "City",
                        "Channel_ID",
                        "Inviter_ID",
                        "SignUp_Origin",
                        "SignUp_Anchor_ID",
                        "SignUp_Anchor_Family_ID",
                        "SignUp_Url",
                        "EXP",
                        "VIP",
                        "VIP_Expire",
                        "Coin",
                        "Coin_Today",
                        "Coin_Week",
                        "Coin_Month",
                        "Coin_Year",
                        "Coin_Total",
                        "Beans",
                        "Beans_Today",
                        "Beans_Week",
                        "Beans_Month",
                        "Beans_Year",
                        "Beans_Total",
                        "Pomelo",
                        "Pomelo_Get_Num",
                        "Pomelo_Get_Date",
                        "Fans",
                        "Attention",
                        "IsAnchor",
                        "IsFamily",
                        "IsAdmin",
                        "OAuth_QQ_ID",
                        "OAuth_Weibo_ID",
                        "OAuth_Weixin_ID",
                        "Charge_First",
                        "Charge_First_Award",
                        "Charge_First_Date",
                        "Charge_Last_Date",
                        "Login_Count",
                        "Login_This_Date",
                        "Login_This_IP",
                        "Create_Date",
                        "Create_IP",
                        "Status"
                    ]);
                    ThisValue.RealName = KOC.StringUtils.Cover(ThisValue.RealName, "Name");
                    ThisValue.IDCard = KOC.StringUtils.Cover(ThisValue.IDCard, "IDCard");
                    ThisValue.Email = KOC.StringUtils.Cover(ThisValue.Email, "Email");
                    ThisValue.Phone = KOC.StringUtils.Cover(ThisValue.Phone, "Phone");
                    ThisValue.QQ = KOC.StringUtils.Cover(ThisValue.QQ, "QQ");
                    ThisValue.Account_RealName = KOC.StringUtils.Cover(ThisValue.Account_RealName, "Name");
                    ThisValue.Account_CardNo = KOC.StringUtils.Cover(ThisValue.Account_CardNo, "Name");//银行卡号 也需要隐藏，暂时没有，先用NAME
                    ThisValue.Account_City = KOC.StringUtils.Cover(ThisValue.Account_City, "Name");//这些账户信息都比较私密，所以都应该隐藏
                    ThisValue.Account_Province = KOC.StringUtils.Cover(ThisValue.Account_Province, "Name");
                    ThisValue.Account_BankName = KOC.StringUtils.Cover(ThisValue.Account_BankName, "Name");
                    ThisValue.Account_BankFullName = KOC.StringUtils.Cover(ThisValue.Account_BankFullName, "Name");
                    ThisValue.OAuth_Phone = !!ThisValue.Phone;
                    ThisValue.OAuth_QQ = !!ThisValue.OAuth_QQ_ID;
                    ThisValue.OAuth_Weibo = !!ThisValue.OAuth_Weibo_ID;
                    ThisValue.OAuth_Weixin = !!ThisValue.OAuth_Weixin_ID;
                    if (ThisValue.VIP && ThisValue.VIP_Expire && KOC.Moment().isAfter(KOC.Moment(ThisValue.VIP_Expire))) {
                        ThisValue.VIP = 0;
                    }
                    if (ThisValue.VIP && ThisValue.VIP_Expire) {
                        ThisValue.VIP_ExpireDay = KOC.Moment(ThisValue.VIP_Expire).diff(KOC.Moment(), "days") < 0 ? 0 : KOC.Moment(ThisValue.VIP_Expire).diff(KOC.Moment(), "days");
                    }
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(ThisValue.EXP);
                    ThisValue.Level = _LevelInfo.Level;
                    ThisValue.Level_Name = _LevelInfo.Level_Name;
                    ThisValue.Level_Next = _LevelInfo.Level_Next;
                    ThisValue.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    ThisValue.EXP_Next = _LevelInfo.EXP_Next;
                    ThisValue.EXP_Difference = _LevelInfo.Difference;
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        UserInfo_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: 0,
                NickName: "",
                RealName: "",
                IDCard: "",
                IDCard_Status: "",
                Email: "",
                Phone: "",
                QQ: "",
                Sex: -1,
                Province: "",
                City: "",
                Channel_ID: "",
                Inviter_ID: 0,
                SignUp_Origin: "",
                SignUp_Anchor_ID: 0,
                SignUp_Anchor_Family_ID: 0,
                Charge_First: -1,
                IsVIP: -1,
                IsAnchor: -1,
                IsFamily: -1,
                IsAdmin: -1,
                OAuth_Phone: -1,
                OAuth_QQ: -1,
                OAuth_Weibo: -1,
                OAuth_Weixin: -1,
                DateType: "",
                StartDate: "",
                EndDate: "",
                Self: "0",
                Status: "0"
            };
        },
        //endregion
        //region UserAnchor 艺人分页列表
        UserAnchor: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_anchor`.`User_ID`";
            PageParm.ColumnMAX = "`user_anchor`.`User_ID`";
            PageParm.ColumnList = "`user_anchor`.`User_ID`" +
                ", `user_anchor`.`Family_Commission`" +
                ", `user_anchor`.`RoomName`" +
                ", `user_anchor`.`RoomWelcome`" +
                ", `user_anchor`.`RoomTemplate`" +
                ", `user_anchor`.`RoomTitle`" +
                ", `user_anchor`.`RoomNotice`" +
                ", `user_anchor`.`Family_ID`" +
                ", `user_anchor`.`Tags`" +
                ", `user_anchor`.`EXP` AS `Anchor_EXP`" +
                ", `user_anchor`.`HotValue_Ranking`" +
                ", `user_anchor`.`HotValue`" +
                ", `user_anchor`.`ActivityNum`" +
                ", `user_anchor`.`Pomelo` AS `Anchor_Pomelo`" +
                ", `user_anchor`.`Pomelo_Today` AS `Anchor_Pomelo_Today`" +
                ", `user_anchor`.`Pomelo_Week` AS `Anchor_Pomelo_Week`" +
                ", `user_anchor`.`Pomelo_Month` AS `Anchor_Pomelo_Month`" +
                ", `user_anchor`.`Pomelo_Year` AS `Anchor_Pomelo_Year`" +
                ", `user_anchor`.`Live`" +
                ", `user_anchor`.`Live_FirstDate`" +
                ", `user_anchor`.`Live_IsMobile`" +
                ", `user_anchor`.`Live_Mode`" +
                ", `user_anchor`.`Live_Order_No`" +
                ", `user_anchor`.`Live_StartTime`" +
                ", `user_anchor`.`Live_Duration_Total`" +
                ", `user_anchor`.`Live_Stream_LastDate`" +
                ", CASE `user_anchor`.`Live` WHEN 1 THEN `user_anchor`.`Live_Stream_Status` ELSE 0 END AS `Live_Stream_Status`" +
                ", `user_anchor`.`Network`" +
                ", `user_anchor`.`IsWeekStar`" +
                ", `user_anchor`.`IsRecommend`" +
                ", `user_anchor`.`ProtectDue_Date`" +
                ", `user_anchor`.`Rating`" +
                ", `user_anchor`.`Rating_Salary`" +
                ", `user_anchor`.`Rating_Task_Beans`" +
                ", `user_anchor`.`Rating_Task_LiveDay`" +
                ", `user_anchor`.`Rating_Task_LiveDuration`" +
                ", `user_anchor`.`Rating_Date`" +
                ", `user_anchor`.`Score`" +
                ", `user_anchor`.`Score_Last`" +
                ", `user_anchor`.`Score_Coin`" +
                ", `user_anchor`.`Score_Coin_Last`" +
                ", `user_anchor`.`Score_SignUp`" +
                ", `user_anchor`.`Score_SignUp_Last`" +
                ", `user_anchor`.`Integral`" +
                ", `user_anchor`.`Integral_Month`" +
                ", `user_anchor`.`Integral_Month_Last`" +
                ", `user_anchor`.`Integral_Week`" +
                ", `user_anchor`.`Integral_Week_Last`" +
                ", `user_anchor`.`Integral_Date`" +
                ", `user_anchor`.`Approve_Admin_ID`" +
                ", `user_anchor`.`Approve_RealName`" +
                ", `user_anchor`.`Approve_Date`" +
                ", `user_anchor`.`Duty_Admin_ID`" +
                ", `user_anchor`.`Duty_RealName`" +
                ", `user_anchor`.`Cover_Admin_ID`" +
                ", `user_anchor`.`Cover_RealName`" +
                ", `user_anchor`.`Cover_Date`" +
                ", `user_anchor`.`List_Order`" +
                ", `user_anchor`.`Create_Date`" +
                ", `user_anchor`.`Create_IP`" +
                ", `user_anchor`.`Status`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`IDCard`" +
                ", `user_info`.`IDCard_Status`" +
                ", `user_info`.`Email`" +
                ", `user_info`.`Phone`" +
                ", `user_info`.`QQ`" +
                ", `user_info`.`Sex`" +
                ", `user_info`.`EXP`" +
                ", `user_info`.`Fans`" +
                ", `user_info`.`Attention`" +
                ", `user_info`.`IsFamily`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`Coin`" +
                ", `user_info`.`Coin_Today`" +
                ", `user_info`.`Coin_Week`" +
                ", `user_info`.`Coin_Month`" +
                ", `user_info`.`Coin_Year`" +
                ", `user_info`.`Coin_Total`" +
                ", `user_info`.`Beans`" +
                ", `user_info`.`Beans_Today`" +
                ", `user_info`.`Beans_Week`" +
                ", `user_info`.`Beans_Month`" +
                ", `user_info`.`Beans_Year`" +
                ", `user_info`.`Beans_Total`" +
                ", `user_info`.`ApplyMoney_LastDate`" +
                ", IFNULL(`family_info`.`Family_Name`, '') AS `Family_Name`" +
                ", IFNULL(`family_info`.`User_ID`, -1) AS `Family_UserID`" +
                ", IFNULL(`user_anchor_hot`.`Value_Previous`, 0) AS `Hot_Value_Previous`" +
                ", IFNULL(`user_anchor_hot`.`Value`, 0) AS `Hot_Value`";
            PageParm.TableList = "`user_anchor` JOIN `user_info` ON `user_anchor`.`User_ID` = `user_info`.`User_ID`" +
                " LEFT JOIN `family_info` ON `user_anchor`.`Family_ID` = `family_info`.`Family_ID`" +
                " LEFT JOIN `user_anchor_hot` ON `user_anchor`.`User_ID` = `user_anchor_hot`.`User_ID`";
            PageParm.Condition = "`user_info`.`Status` = 0 AND `user_info`.`IsAnchor` = 1";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`RoomName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`RealName` = :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`IDCard` = :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Email` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Phone` = :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`family_info`.`Family_Name` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`User_ID` = :User_ID", "AND");
            }
            if (parm.NickName) {
                parm.NickName = "%" + parm.NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`NickName` LIKE :NickName", "AND");
            }
            if (parm.RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`RealName` = :RealName", "AND");
            }
            if (parm.IDCard) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`IDCard` = :IDCard", "AND");
            }
            var _IDCard_Status = [];
            KOC.Lodash.forEach(String(parm.IDCard_Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -100) >= -1) {
                    _Status.push(ThisValue);
                }
            });
            if (_IDCard_Status.length > 0) {
                parm.IDCard_Status = _IDCard_Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`IDCard_Status` IN (:IDCard_Status)", "AND");
            }
            if (parm.Email) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Email` = :Email", "AND");
            }
            if (parm.Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Phone` = :Phone", "AND");
            }
            if (parm.QQ) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`QQ` = :QQ", "AND");
            }
            if (parm.Sex > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Sex` = :Sex", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Family_ID` = :Family_ID", "AND");
            }
            if (parm.Approve_Admin_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Approve_Admin_ID` = :Approve_Admin_ID", "AND");
            }
            if (parm.Duty_Admin_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Duty_Admin_ID` = :Duty_Admin_ID", "AND");
            }
            if (parm.Cover_Admin_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Cover_Admin_ID` = :Cover_Admin_ID", "AND");
            }
            if (parm.Tags) {
                parm.Tags = "%" + parm.Tags + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Tags` Like :Tags", "AND");
            }
            if (parm.Live >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Live` = :Live", "AND");
            }
            if (parm.Live_IsMobile >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Live_IsMobile` = :Live_IsMobile", "AND");
            }
            if (parm.Live_Stream_Status >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Live_Stream_Status` = :Live_Stream_Status", "AND");
            }
            var _Live_Mode = [];
            KOC.Lodash.forEach(String(parm.Live_Mode).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Live_Mode.push(ThisValue);
                }
            });
            if (_Live_Mode.length > 0) {
                parm.Live_Mode = _Live_Mode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Live_Mode` IN (:Live_Mode)", "AND");
            }

            var _Network = [];
            KOC.Lodash.forEach(String(parm.Network).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -2) >= -1) {
                    _Network.push(ThisValue);
                }
            });
            if (_Network.length > 0) {
                parm.Network = _Network;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Network` IN (:Network)", "AND");
            }
            if (parm.IsFamily >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`IsFamily` = :IsFamily", "AND");
            }
            if (parm.IsWeekStar >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`IsWeekStar` = :IsWeekStar", "AND");
            }
            if (parm.IsRecommend >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`IsRecommend` = :IsRecommend", "AND");
            }
            if (parm.Start_AnchorEXP > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Anchor_EXP` >= :Start_AnchorEXP", "AND");
            }
            if (parm.End_AnchorEXP > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Anchor_EXP` <= :End_AnchorEXP", "AND");
            }
            if (parm.Start_Integral > 0) {
                var _Integral = "Integral";
                if (KOC.Lodash.includes(["Month", "Month_Last", "Week", "Week_Last"], parm.Integral_Type)) {
                    _Integral += "_" + parm.Integral_Type;
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`" + _Integral + "` >= :Start_Integral", "AND");
            }
            if (parm.End_Integral > 0) {
                var _Integral = "Integral";
                if (KOC.Lodash.includes(["Month", "Month_Last", "Week", "Week_Last"], parm.Integral_Type)) {
                    _Integral += "_" + parm.Integral_Type;
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`" + _Integral + "` <= :End_Integral", "AND");
            }
            if (parm.ProtectDue_Date == 1) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`ProtectDue_Date` IS NULL", "AND");
            } else if (parm.ProtectDue_Date == 2) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`ProtectDue_Date` IS NOT NULL", "AND");
            }
            //时间段查询(艺人申请入驻时间,第一次开播时间,最近一次流状态改变时间,保护期时间,评级时间,最近一次罚分时间,审核艺人时间,审核封面时间)
            if (KOC.Lodash.includes([
                    "Create_Date"
                    , "Live_FirstDate"
                    , "Live_StartTime"
                    , "Live_Stream_LastDate"
                    , "ProtectDue_Date"
                    , "Rating_Date"
                    , "Integral_Date"
                    , "Approve_Date"
                    , "Cover_Date"], parm.DateType)) {
                parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
                if (parm.StartDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`" + parm.DateType + "` >= :StartDate", "AND");
                }
                parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
                if (parm.EndDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`" + parm.DateType + "` <= :EndDate", "AND");
                }
            }
            //按艺人评级查询(-1:没有评级,0-未签约的艺人,6-D级,7-C级,8-B级,9-A级,10-S级)
            var _Rating = [];
            KOC.Lodash.forEach(String(parm.Rating).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -2) >= -1) {
                    _Rating.push(ThisValue);
                }
            });
            if (_Rating.length > 0) {
                parm.Rating = _Rating;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Rating` IN (:Rating)", "AND");
            }
            var _Status = [];
            KOC.Lodash.forEach(String(parm.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                parm.Status = _Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Status` IN (:Status)", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "User_ID",
                        "Family_Commission",
                        "RoomName",
                        "RoomWelcome",
                        "RoomTemplate",
                        "RoomTitle",
                        "RoomNotice",
                        "Family_ID",
                        "Tags",
                        "Anchor_EXP",
                        "HotValue_Ranking",
                        "HotValue",
                        "ActivityNum",
                        "Anchor_Pomelo",
                        "Anchor_Pomelo_Today",
                        "Anchor_Pomelo_Week",
                        "Anchor_Pomelo_Month",
                        "Anchor_Pomelo_Year",
                        "Live",
                        "Live_FirstDate",
                        "Live_IsMobile",
                        "Live_Mode",
                        "Live_Order_No",
                        "Live_StartTime",
                        "Live_Duration_Total",
                        "Live_Stream_LastDate",
                        "Live_Stream_Status",
                        "Network",
                        "IsWeekStar",
                        "IsRecommend",
                        "ProtectDue_Date",
                        "Rating",
                        "Rating_Salary",
                        "Rating_Task_Beans",
                        "Rating_Task_LiveDay",
                        "Rating_Task_LiveDuration",
                        "Rating_Date",
                        "Score",
                        "Score_Last",
                        "Score_Coin",
                        "Score_Coin_Last",
                        "Score_SignUp",
                        "Score_SignUp_Last",
                        "Integral",
                        "Integral_Month",
                        "Integral_Month_Last",
                        "Integral_Week",
                        "Integral_Week_Last",
                        "Integral_Date",
                        "Approve_Admin_ID",
                        "Approve_RealName",
                        "Approve_Date",
                        "Duty_Admin_ID",
                        "Duty_RealName",
                        "Cover_Admin_ID",
                        "Cover_RealName",
                        "Cover_Date",
                        "List_Order",
                        "Create_Date",
                        "Create_IP",
                        "Status",
                        "NickName",
                        "RealName",
                        "Signature",
                        "IDCard",
                        "IDCard_Status",
                        "Email",
                        "Phone",
                        "QQ",
                        "Sex",
                        "EXP",
                        "Fans",
                        "Attention",
                        "IsFamily",
                        "IsAnchor",
                        "Coin",
                        "Coin_Today",
                        "Coin_Week",
                        "Coin_Month",
                        "Coin_Year",
                        "Coin_Total",
                        "Beans",
                        "Beans_Today",
                        "Beans_Week",
                        "Beans_Month",
                        "Beans_Year",
                        "Beans_Total",
                        "ApplyMoney_LastDate ",
                        "Family_Name",
                        "Family_UserID",
                        "Hot_Value_Previous",
                        "Hot_Value"
                    ]);
                    ThisValue.RealName = KOC.StringUtils.Cover(ThisValue.RealName, "Name");
                    ThisValue.IDCard = KOC.StringUtils.Cover(ThisValue.IDCard, "IDCard");
                    ThisValue.Email = KOC.StringUtils.Cover(ThisValue.Email, "Email");
                    ThisValue.Phone = KOC.StringUtils.Cover(ThisValue.Phone, "Phone");
                    ThisValue.QQ = KOC.StringUtils.Cover(ThisValue.QQ, "QQ");
                    var _LevelInfo = CommonUtils.User.Level.fnLevelInfo(ThisValue.EXP);
                    ThisValue.Level = _LevelInfo.Level;
                    ThisValue.Level_Name = _LevelInfo.Level_Name;
                    ThisValue.Level_Next = _LevelInfo.Level_Next;
                    ThisValue.Level_Next_Name = _LevelInfo.Level_Next_Name;
                    ThisValue.EXP_Next = _LevelInfo.EXP_Next;
                    ThisValue.EXP_Difference = _LevelInfo.Difference;
                    var _AnchorLevelInfo = CommonUtils.Anchor.Level.fnLevelInfo(ThisValue.Anchor_EXP);
                    ThisValue.Anchor_Level = _AnchorLevelInfo.Level;
                    ThisValue.Anchor_Level_Name = _AnchorLevelInfo.Level_Name;
                    ThisValue.Anchor_Level_Next = _AnchorLevelInfo.Level_Next;
                    ThisValue.Anchor_Level_Next_Name = _AnchorLevelInfo.Level_Next_Name;
                    ThisValue.Anchor_EXP_Next = _AnchorLevelInfo.EXP_Next;
                    ThisValue.Anchor_EXP_Difference = _AnchorLevelInfo.Difference;
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        UserAnchor_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: -1,
                NickName: "",
                RealName: "",
                IDCard: "",
                IDCard_Status: "",
                Email: "",
                Phone: "",
                QQ: "",
                Sex: -1,
                Family_ID: -1,
                Approve_Admin_ID: -1,
                Duty_Admin_ID: -1,
                Cover_Admin_ID: -1,
                Tags: "",
                Live: -1,
                Live_IsMobile: -1,
                Live_Mode: -1,
                Live_Stream_Status: -1,
                Network: -2,
                IsFamily: -1,
                IsWeekStar: -1,
                IsRecommend: -1,
                Rating: "",
                Start_AnchorEXP: -1,
                End_AnchorEXP: -1,
                Start_Integral: -1,
                End_Integral: -1,
                Integral_Type: "",
                ProtectDue_Date: "",
                DateType: "",
                StartDate: "",
                EndDate: "",
                Status: ""
            };
        },
        //endregion
        //region UserMobile:用户帐户移动设备信息
        UserMobile: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_mobile`.`Mobile_ID`";
            PageParm.ColumnMAX = "`user_mobile`.`Mobile_ID`";
            PageParm.ColumnList = "`user_mobile`.`Mobile_ID`," +
                " `user_mobile`.`User_ID`," +
                " `user_mobile`.`Equipment_Code`," +
                " `user_mobile`.`Equipment_Type`," +
                " `user_mobile`.`Equipment_Name`," +
                " `user_mobile`.`Screen_Width`," +
                " `user_mobile`.`Screen_Height`," +
                " `user_mobile`.`OS_Version`," +
                " `user_mobile`.`Longitude`," +
                " `user_mobile`.`Latitude`," +
                " `user_mobile`.`LocationDate`," +
                // " `user_mobile`.`Open_Count`," +
                // " `user_mobile`.`Open_Last_Date`," +
                // " `user_mobile`.`Create_Date`," +
                " `user_mobile`.`Status` AS `Mobile_Status`," +
                " `user_mobile_app`.`APP_Type`," +
                " `user_mobile_app`.`APP_Version`," +
                " `user_mobile_app`.`APP_VersionCode`," +
                " `user_mobile_app`.`Auth_Code`," +
                " `user_mobile_app`.`Open_Count`," +
                " `user_mobile_app`.`Open_Last_Date`," +
                " `user_mobile_app`.`Create_Date` AS `MobileApp_CreateDate`," +
                " `user_mobile_app`.`Status` AS `MobileApp_Status`";
            PageParm.TableList = "`user_mobile` LEFT JOIN `user_mobile_app` ON `user_mobile`.`Mobile_ID` = `user_mobile_app`.`Mobile_ID`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_mobile`.`Equipment_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_mobile`.`Equipment_Code` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_mobile`.`Mobile_ID` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_mobile`.`OS_Version` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_mobile_app`.`APP_Version` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_mobile`.`Mobile_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile`.`User_ID` = :User_ID", "AND");
            }
            if (parm.Mobile_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile`.`Mobile_ID` = :Mobile_ID", "AND");
            }
            if (parm.Equipment_Name) {
                parm.Equipment_Name = "%" + parm.Equipment_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile`.`Equipment_Name` LIKE :Equipment_Name", "AND");
            }
            if (parm.OS_Version) {
                parm.OS_Version = "%" + parm.OS_Version + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile`.`OS_Version` LIKE :OS_Version", "AND");
            }
            if (parm.APP_Version) {
                parm.APP_Version = "%" + parm.APP_Version + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile_app`.`APP_Version` LIKE :APP_Version", "AND");
            }
            if (parm.Equipment_Code) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile`.`Equipment_Code` = :Equipment_Code", "AND");
            }
            var _Equipment_Type = [];
            KOC.Lodash.forEach(String(parm.Equipment_Type).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Equipment_Type.push(ThisValue);
                }
            });
            if (_Equipment_Type.length > 0) {
                parm.Equipment_Type = _Equipment_Type;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile`.`Equipment_Type` IN (:Equipment_Type)", "AND");
            }
            if (KOC.Lodash.includes(["Create_Date", "Open_Last_Date"], parm.DateType)) {
                parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
                if (parm.StartDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile_app`.`" + parm.DateType + "` >= :StartDate", "AND");
                }
                parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
                if (parm.EndDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile_app`.`" + parm.DateType + "` <= :EndDate", "AND");
                }
            }
            var _Status = [];
            KOC.Lodash.forEach(String(parm.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                parm.Status = _Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_mobile`.`Status` IN (:Status)", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "Mobile_ID",
                        "User_ID",
                        "Equipment_Code",
                        "Equipment_Type",
                        "Equipment_Name",
                        "Screen_Width",
                        "Screen_Height",
                        "OS_Version",
                        "Longitude",
                        "Latitude",
                        "LocationDate",
                        "Open_Count",
                        "Open_Last_Date",
                        "APP_Type",
                        "APP_Version",
                        "APP_VersionCode",
                        "Auth_Code",
                        "Mobile_Status",
                        "MobileApp_Status",
                        "MobileApp_CreateDate",
                        "Create_IP"
                    ]);
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        UserMobile_Parm: function () {
            return {
                FuzzyQuery: "",
                Mobile_ID: 0,
                User_ID: 0,
                Equipment_Name: "",
                Equipment_Type: "",
                Equipment_Code: "",
                OS_Version: "",
                APP_Version: "",
                DateType: "",
                StartDate: "",
                EndDate: "",
                Status: "0"
            };
        },
        //endregion
        //region UserBankTrade:用户帐户交易信息
        UserBankTrade: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Trade_ID`";
            PageParm.ColumnMAX = "`Trade_ID`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`user_bank_trade`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_RealName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_User_RealName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_Family_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Trade_Order_No` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_Family_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.User_Channel_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_Channel_ID` = :User_Channel_ID", "AND");
            }
            if (parm.Related_User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_User_ID` = :Related_User_ID", "AND");
            }
            if (parm.Related_User_NickName) {
                parm.Related_User_NickName = "%" + parm.Related_User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_User_NickName` LIKE :Related_User_NickName", "AND");
            }
            if (parm.Related_User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_User_RealName` = :Related_User_RealName", "AND");
            }
            if (parm.Related_Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_User_ID` = :Related_User_ID", "AND");
            }
            if (parm.Related_Family_Name) {
                parm.Related_Family_Name = "%" + parm.Related_Family_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_Family_Name` LIKE :Related_Family_Name", "AND");
            }
            if (parm.Trade_Currency > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Currency` = :Trade_Currency", "AND");
            }
            if (parm.Trade_Type > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Type` = :Trade_Type", "AND");
            }
            if (KOC.Lodash.includes([1, -1], parm.Trade_Flag)) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Flag` = :Trade_Flag", "AND");
            }
            if (parm.Trade_Amt_MIN >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Amt` >= :Trade_Amt_MIN", "AND");
            }
            if (parm.Trade_Amt_MAX >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Amt` <= :Trade_Amt_MAX", "AND");
            }
            if (parm.Trade_Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Order_No` = :Trade_Order_No", "AND");
            }
            if (parm.Remark) {
                parm.Remark = "%" + parm.Remark + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Remark` LIKE :Remark", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            if (parm.Create_IP) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_IP` = :Create_IP", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "Trade_ID",
                        "User_ID",
                        "User_NickName",
                        "User_RealName",
                        "User_Channel_ID",
                        "Related_User_ID",
                        "Related_User_NickName",
                        "Related_User_RealName",
                        "Related_Family_ID",
                        "Related_Family_Name",
                        "Trade_Currency",
                        "Trade_Type",
                        "Trade_Type_Name",
                        "Trade_Flag",
                        "Trade_Amt",
                        "Trade_Order_No",
                        "Amt",
                        "Remark",
                        "Create_Date",
                        "Create_IP"
                    ]);
                    ThisValue.User_RealName = KOC.StringUtils.Cover(ThisValue.User_RealName, "Name");
                    ThisValue.Related_User_RealName = KOC.StringUtils.Cover(ThisValue.Related_User_RealName, "Name");
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        UserBankTrade_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: -1,
                User_NickName: "",
                User_RealName: "",
                User_Channel_ID: "",
                Related_User_ID: -1,
                Related_User_NickName: "",
                Related_User_RealName: "",
                Related_Family_ID: -1,
                Related_Family_Name: "",
                Trade_Currency: -1,
                Trade_Type: -1,
                Trade_Flag: 0,
                Trade_Amt_MIN: -1,
                Trade_Amt_MAX: -1,
                Trade_Order_No: "",
                Remark: "",
                StartDate: "",
                EndDate: "",
                Create_IP: ""
            };
        },
        //endregion
        //region UserPackage:用户包裹信息
        UserPackage: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`User_ID`";
            PageParm.ColumnMAX = "`User_ID`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`user_package`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Item_Name` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Item_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.Item_Type && parm.Item_Type != "-1") {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Item_Type` = :Item_Type", "AND");
            }
            if (parm.Item_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Item_ID` = :Item_ID", "AND");
            }
            if (parm.Item_Name) {
                parm.Item_Name = "%" + parm.Item_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Item_Name` LIKE :Item_Name", "AND");
            }
            if (parm.Num_MIN >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Num` >= :Num", "AND");
            }
            if (parm.Num_MAX >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Num` <= :Num", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "User_ID",
                        "Item_Type",
                        "Item_ID",
                        "Item_Name",
                        "Num"
                    ]);
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        UserPackage_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: 0,
                Item_Type: null,
                Item_ID: "",
                Item_Name: "",
                Num: 0
            };
        },
        //endregion
        //region UserPackageTrade:用户包裹交易信息
        UserPackageTrade: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Trade_ID`";
            PageParm.ColumnMAX = "`Trade_ID`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`user_package_trade`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_RealName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Item_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Item_Type` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Item_ID` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Trade_Order_No` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.Item_Type && parm.Item_Type != "-1") {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Item_Type` = :Item_Type", "AND");
            }
            if (parm.Item_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Item_ID` = :Item_ID", "AND");
            }
            if (parm.Item_Name) {
                parm.Item_Name = "%" + parm.Item_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Item_Name` LIKE :Item_Name", "AND");
            }
            if (parm.Trade_Type > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Type` = :Trade_Type", "AND");
            }
            if (KOC.Lodash.includes([1, -1], parm.Trade_Flag)) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Flag` = :Trade_Flag", "AND");
            }
            if (parm.Trade_Num_MIN >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Num` >= :Trade_Num_MIN", "AND");
            }
            if (parm.Trade_Num_MAX >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Num` <= :Trade_Num_MAX", "AND");
            }
            if (parm.Trade_Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Order_No` = :Trade_Order_No", "AND");
            }
            if (parm.Remark) {
                parm.Remark = "%" + parm.Remark + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Remark` LIKE :Remark", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            if (parm.Create_IP) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_IP` = :Create_IP", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "Trade_ID",
                        "User_ID",
                        "User_NickName",
                        "User_RealName",
                        "Item_Type",
                        "Item_ID",
                        "Item_Name",
                        "Trade_Type",
                        "Trade_Type_Name",
                        "Trade_Flag",
                        "Trade_Num",
                        "Trade_Order_No",
                        "Num",
                        "Remark",
                        "Create_Date",
                        "Create_IP"
                    ]);
                    ThisValue.User_RealName = KOC.StringUtils.Cover(ThisValue.User_RealName, "Name");
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        UserPackageTrade_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: -1,
                User_NickName: "",
                User_RealName: "",
                Item_Type: null,
                Item_ID: "",
                Item_Name: "",
                Trade_Type: -1,
                Trade_Flag: 0,
                Trade_Num_MIN: -1,
                Trade_Num_MAX: -1,
                Trade_Order_No: "",
                Remark: "",
                StartDate: "",
                EndDate: "",
                Create_IP: ""
            };
        },
        //endregion
        //region OrderLive:直播单据信息
        OrderLive: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Order_No`";
            PageParm.ColumnMAX = "`Order_No`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`order_live`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_Name` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Order_No` = :Order_No", "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_ID` = :Family_ID", "AND");
            }
            if (parm.Family_Name) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_Name` = :Family_Name", "AND");
            }
            if (parm.IsMobile >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`IsMobile` = :IsMobile", "AND");
            }
            if (parm.Mode >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Mode` = :Mode", "AND");
            }
            if (KOC.Lodash.includes(["Create_Date", "End_Date"], parm.DateType)) {
                parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
                if (parm.StartDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`" + parm.DateType + "` >= :StartDate", "AND");
                }
                parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
                if (parm.EndDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`" + parm.DateType + "` <= :EndDate", "AND");
                }
            }
            var _Status = [];
            KOC.Lodash.forEach(String(parm.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                parm.Status = _Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Status` IN (:Status)", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderLive_Parm: function () {
            return {
                FuzzyQuery: "",
                Order_No: "",
                User_ID: 0,
                User_NickName: "",
                User_RealName: "",
                Family_ID: 0,
                Family_Name: "",
                IsMobile: -1,
                Mode: -1,
                DateType: "",
                StartDate: "",
                EndDate: "",
                Status: ""
            };
        },
        //endregion
        //region OrderGift:送礼单据信息
        OrderGift: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Order_No`";
            PageParm.ColumnMAX = "`Order_No`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`order_gift`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Live_Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName_Gift` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_Name` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Gift_Name` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID_Anchor` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Order_No` = :Order_No", "AND");
            }
            if (parm.Live_Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Live_Order_No` = :Live_Order_No", "AND");
            }
            if (parm.User_ID_Anchor > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID_Anchor` = :User_ID_Anchor", "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.User_ID_Gift > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID_Gift` = :User_ID_Gift", "AND");
            }
            if (parm.User_NickName_Gift) {
                parm.User_NickName_Gift = "%" + parm.User_NickName_Gift + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName_Gift` LIKE :User_NickName_Gift", "AND");
            }
            if (parm.User_RealName_Gift) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName_Gift` = :User_RealName_Gift", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_ID` = :Family_ID", "AND");
            }
            if (parm.Family_Name) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_Name` = :Family_Name", "AND");
            }
            if (parm.Gift_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Gift_ID` = :Gift_ID", "AND");
            }
            if (parm.Lucky >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Lucky` = :Lucky", "AND");
            }
            if (parm.PurchaseMode > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`PurchaseMode` = :PurchaseMode", "AND");
            }
            if (parm.IsTask >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`IsTask` = :IsTask", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderGift_Parm: function () {
            return {
                FuzzyQuery: "",
                Order_No: "",
                Live_Order_No: "",
                User_ID_Anchor: 0,
                User_ID: -1,
                User_NickName: "",
                User_RealName: "",
                User_ID_Gift: 0,
                User_NickName_Gift: "",
                User_RealName_Gift: "",
                Family_ID: 0,
                Family_Name: "",
                Gift_ID: 0,
                Lucky: -1,
                PurchaseMode: -1,
                IsTask: -1,
                StartDate: "",
                EndDate: ""
            };
        },
        //endregion
        //region OrderGuardian:守护单据信息
        OrderGuardian: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Order_No`";
            PageParm.ColumnMAX = "`Order_No`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`order_guardian`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Live_Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName_Guardian` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_Name` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Guardian_Name` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID_Guardian` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Order_No` = :Order_No", "AND");
            }
            if (parm.Live_Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Live_Order_No` = :Live_Order_No", "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.User_ID_Guardian > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID_Guardian` = :User_ID_Guardian", "AND");
            }
            if (parm.User_NickName_Guardian) {
                parm.User_NickName_Guardian = "%" + parm.User_NickName_Guardian + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName_Guardian` LIKE :User_NickName_Guardian", "AND");
            }
            if (parm.User_RealName_Guardian) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName_Guardian` = :User_RealName_Guardian", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_ID` = :Family_ID", "AND");
            }
            if (parm.Guardian_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Guardian_ID` = :Guardian_ID", "AND");
            }
            if (parm.Guardian_Mode) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Guardian_Mode` = :Guardian_Mode", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderGuardian_Parm: function () {
            return {
                FuzzyQuery: "",
                Order_No: "",
                Live_Order_No: "",
                User_ID: 0,
                User_NickName: "",
                User_RealName: "",
                User_ID_Guardian: 0,
                User_NickName_Guardian: "",
                User_RealName_Guardian: "",
                Family_ID: 0,
                Guardian_ID: 0,
                Guardian_Mode: "",
                StartDate: "",
                EndDate: ""
            };
        },
        //endregion
        //region OrderHorn:喇叭单据信息
        OrderHorn: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Order_No`";
            PageParm.ColumnMAX = "`Order_No`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`order_horn`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Live_Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName_Anchor` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_Name` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID_Anchor` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Order_No` = :Order_No", "AND");
            }
            if (parm.Live_Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Live_Order_No` = :Live_Order_No", "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.User_ID_Anchor > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID_Anchor` = :User_ID_Anchor", "AND");
            }
            if (parm.User_NickName_Anchor) {
                parm.User_NickName_Anchor = "%" + parm.User_NickName_Anchor + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName_Anchor` LIKE :User_NickName_Anchor", "AND");
            }
            if (parm.User_RealName_Anchor) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName_Anchor` = :User_RealName_Anchor", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_ID` = :Family_ID", "AND");
            }
            if (parm.Family_Name) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_Name` = :Family_Name", "AND");
            }
            if (parm.Horn_Mode && parm.Horn_Mode != "-1") {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Horn_Mode` = :Horn_Mode", "AND");
            }
            if (parm.PurchaseMode > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`PurchaseMode` = :PurchaseMode", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderHorn_Parm: function () {
            return {
                FuzzyQuery: "",
                Order_No: "",
                Live_Order_No: "",
                User_ID: 0,
                User_NickName: "",
                User_RealName: "",
                User_ID_Anchor: 0,
                User_NickName_Anchor: "",
                User_RealName_Anchor: "",
                Family_ID: 0,
                Family_Name: "",
                Horn_Mode: "",
                PurchaseMode: -1,
                StartDate: "",
                EndDate: ""
            };
        },
        //endregion
        //region OrderMounts:用户购买坐骑列表
        OrderMounts: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Order_No`";
            PageParm.ColumnMAX = "`Order_No`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`order_mounts`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Mounts_Name` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Mounts_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Order_No` = :Order_No", "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.Mounts_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Mounts_ID` = :Mounts_ID", "AND");
            }
            if (parm.Mounts_Name) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Mounts_Name` = :Mounts_Name", "AND");
            }
            var _Mounts_Mode = [];
            KOC.Lodash.forEach(String(parm.Mounts_Mode).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Mounts_Mode.push(ThisValue);
                }
            });
            if (_Mounts_Mode.length > 0) {
                parm.Equipment_Type = _Mounts_Mode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Mounts_Mode` IN (:Mounts_Mode)", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderMounts_Parm: function () {
            return {
                FuzzyQuery: "",
                Order_No: "",
                User_ID: 0,
                User_NickName: "",
                User_RealName: "",
                Mounts_ID: 0,
                Mounts_Name: "",
                Mounts_Mode: null,
                StartDate: "",
                EndDate: ""
            };
        },
        //endregion
        //region OrderVIP:VIP购买单据信息
        OrderVIP: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Order_No`";
            PageParm.ColumnMAX = "`Order_No`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`order_vip`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`VIP_Name` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Order_No` = :Order_No", "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.VIP_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`VIP_ID` = :VIP_ID", "AND");
            }
            if (parm.VIP_Mode) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`VIP_Mode` = :VIP_Mode", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderVIP_Parm: function () {
            return {
                FuzzyQuery: "",
                Order_No: "",
                User_ID: 0,
                User_NickName: "",
                User_RealName: "",
                VIP_ID: 0,
                VIP_Mode: "",
                StartDate: "",
                EndDate: ""
            };
        },
        //endregion
        //region OrderAnchorIntegral:艺人罚分单据信息
        OrderAnchorIntegral: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Order_No`";
            PageParm.ColumnMAX = "`Order_No`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`order_anchorintegral`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Order_No` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_Name` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Order_No` = :Order_No", "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_ID` = :Family_ID", "AND");
            }
            if (parm.User_ID_Admin > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID_Admin` = :User_ID_Admin", "AND");
            }
            if (parm.Operation >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Operation` = :Operation", "AND");
            }
            if (parm.Inform >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Inform` = :Inform", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderAnchorIntegral_Parm: function () {
            return {
                FuzzyQuery: "",
                Order_No: "",
                User_ID: 0,
                User_NickName: "",
                User_RealName: "",
                Family_ID: 0,
                User_ID_Admin: 0,
                Operation: -1,
                Inform: -1,
                StartDate: "",
                EndDate: ""
            };
        },
        //endregion
        //*******************************待郭哥检查
        //region FamilyInfo:公会列表
        FamilyInfo: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`family_info`.`Family_ID`";
            PageParm.ColumnMAX = "`family_info`.`Family_ID`";
            PageParm.ColumnList = "`family_info`.`Family_ID`" +
                ", `family_info`.`Family_Name`" +
                ", `family_info`.`User_ID`" +
                ", `family_info`.`Account_RealName`" +
                ", `family_info`.`Account_CardNo`" +
                ", `family_info`.`Account_City`" +
                ", `family_info`.`Account_Province`" +
                ", `family_info`.`Account_BankName`" +
                ", `family_info`.`Account_BankFullName`" +
                ", `family_info`.`Beans` AS `Family_Beans`" +
                ", `family_info`.`Beans_Total` AS `Family_Beans_Total`" +
                ", `family_info`.`Anchor_Num`" +
                ", `family_info`.`ContactName`" +
                ", `family_info`.`Phone` AS `Family_Phone`" +
                ", `family_info`.`QQ` AS `Family_QQ`" +
                ", `family_info`.`Email` AS `Family_Email`" +
                ", `family_info`.`Approve_Admin_ID`" +
                ", `family_info`.`Approve_RealName`" +
                ", `family_info`.`Approve_Date`" +
                ", `family_info`.`Create_Date`" +
                ", `family_info`.`Create_IP`" +
                ", `family_info`.`Settlement`" +
                ", `family_info`.`Status`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`QQ`" +
                ", `user_info`.`Email`" +
                ", `user_info`.`Phone`";
            PageParm.TableList = "`family_info` JOIN `user_info` ON `family_info`.`User_ID` = `user_info`.`User_ID`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`family_info`.`Family_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`family_info`.`ContactName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`family_info`.`Account_RealName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`RealName` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`family_info`.`Family_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`family_info`.`User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`family_info`.`Phone` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`family_info`.`QQ` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Family_ID` = :Family_ID", "AND");
            }
            if (parm.Family_Name) {
                parm.Family_Name = "%" + parm.Family_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Family_Name` LIKE :Family_Name", "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`User_ID` = :User_ID", "AND");
            }
            if (parm.NickName) {
                parm.NickName = "%" + parm.NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`NickName` LIKE :NickName", "AND");
            }
            if (parm.RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`RealName` = :RealName", "AND");
            }
            if (parm.Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Phone` = :Phone", "AND");
            }
            if (parm.QQ) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`QQ` = :QQ", "AND");
            }
            if (parm.Email) {
                parm.Family_Email = "%" + parm.Family_Email + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Email` LIKE :Email", "AND");
            }
            if (parm.Account_RealName) {
                parm.Account_RealName = "%" + parm.Account_RealName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Account_RealName` LIKE :Account_RealName", "AND");
            }
            if (parm.Account_CardNo) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Account_CardNo` = :Account_CardNo", "AND");
            }
            if (parm.ContactName) {
                parm.ContactName = "%" + parm.ContactName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`ContactName` LIKE :ContactName", "AND");
            }
            if (parm.Start_Anchor_Num > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Anchor_Num` >= :Start_Anchor_Num", "AND");
            }
            if (parm.End_Anchor_Num > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Anchor_Num` <= :End_Anchor_Num", "AND");
            }
            if (parm.Family_Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Phone` = :Family_Phone", "AND");
            }
            if (parm.Family_QQ) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`QQ` = :Family_QQ", "AND");
            }
            if (parm.Family_Email) {
                parm.Family_Email = "%" + parm.Family_Email + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Email` LIKE :Family_Email", "AND");
            }
            if (parm.Approve_Admin_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Approve_Admin_ID` = :Approve_Admin_ID", "AND");
            }
            if (parm.Approve_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Approve_RealName` = :Approve_RealName", "AND");
            }
            if (KOC.Lodash.includes(["Create_Date", "Approve_Date"], parm.DateType)) {
                parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
                if (parm.StartDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`" + parm.DateType + "` >= :StartDate", "AND");
                }
                parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
                if (parm.EndDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`" + parm.DateType + "` <= :EndDate", "AND");
                }
            }
            if (parm.Settlement > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Settlement` = :Settlement", "AND");
            }
            var _Status = [];
            KOC.Lodash.forEach(String(parm.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                parm.Status = _Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`family_info`.`Status` IN (:Status)", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "Family_ID",
                        "Family_Name",
                        "User_ID",
                        "Account_RealName",
                        "Account_CardNo",
                        "Account_City",
                        "Account_Province",
                        "Account_BankName",
                        "Account_BankFullName",
                        "Family_Beans",
                        "Family_Beans_Total",
                        "Anchor_Num",
                        "ContactName",
                        "Family_Phone",
                        "Family_QQ",
                        "Family_Email",
                        "Approve_Admin_ID",
                        "Approve_RealName",
                        "Approve_Date",
                        "Create_Date",
                        "Create_IP",
                        "Settlement",
                        "Status",
                        "NickName",
                        "RealName",
                        "Email",
                        "Phone",
                        "QQ"
                    ]);
                    ThisValue.Account_RealName = KOC.StringUtils.Cover(ThisValue.Account_RealName, "Name");
                    ThisValue.Account_CardNo = KOC.StringUtils.Cover(ThisValue.Account_CardNo, "Name");
                    ThisValue.Family_Phone = KOC.StringUtils.Cover(ThisValue.Family_Phone, "Phone");
                    ThisValue.Family_QQ = KOC.StringUtils.Cover(ThisValue.Family_QQ, "QQ");
                    ThisValue.Family_Email = KOC.StringUtils.Cover(ThisValue.Family_Email, "Email");
                    ThisValue.RealName = KOC.StringUtils.Cover(ThisValue.RealName, "Name");
                    ThisValue.Email = KOC.StringUtils.Cover(ThisValue.Email, "Email");
                    ThisValue.Phone = KOC.StringUtils.Cover(ThisValue.Phone, "Phone");
                    ThisValue.QQ = KOC.StringUtils.Cover(ThisValue.QQ, "QQ");
                    ThisValue.Approve_RealName = KOC.StringUtils.Cover(ThisValue.Approve_RealName, "Name");
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        FamilyInfo_Parm: function () {
            return {
                FuzzyQuery: "",
                Family_ID: 0,
                User_ID: 0,
                NickName: "",
                RealName: "",
                Email: "",
                Phone: "",
                QQ: "",
                Account_RealName: "",
                Account_CardNo: "",
                ContactName: "",
                Start_Anchor_Num: 0,
                End_Anchor_Num: 0,
                Family_Phone: "",
                Family_QQ: "",
                Family_Email: "",
                Approve_Admin_ID: 0,
                Approve_RealName: "",
                DateType: "",
                StartDate: "",
                EndDate: "",
                Settlement: 0,
                Status: ""
            };
        },
        //endregion
        //region FamilyBankTrade: 公会资金交易信息
        FamilyBankTrade: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Trade_ID`";
            PageParm.ColumnMAX = "`Trade_ID`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`family_bank_trade`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_Anchor_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_Anchor_RealName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_User_RealName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Trade_Type_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Trade_Order_No` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Related_Anchor_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Trade_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_ID` = :Trade_ID", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_ID` = :Family_ID", "AND");
            }
            if (parm.Family_Name) {
                parm.Family_Name = "%" + parm.Family_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_Name` LIKE :Family_Name", "AND");
            }
            if (parm.Related_User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_User_ID` = :Related_User_ID", "AND");
            }
            if (parm.Related_User_NickName) {
                parm.Related_User_NickName = "%" + parm.Related_User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_User_NickName` LIKE :Related_User_NickName", "AND");
            }
            if (parm.Related_User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_User_RealName` = :Related_User_RealName", "AND");
            }
            if (parm.Related_Anchor_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_Anchor_ID` = :Related_Anchor_ID", "AND");
            }
            if (parm.Related_Anchor_NickName) {
                parm.Related_Anchor_NickName = "%" + parm.Related_Anchor_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_Anchor_NickName` LIKE :Related_Anchor_NickName", "AND");
            }
            if (parm.Related_Anchor_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Related_Anchor_RealName` = :Related_Anchor_RealName", "AND");
            }
            if (KOC.Lodash.includes([1, -1], parm.Trade_Flag)) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Flag` = :Trade_Flag", "AND");
            }
            if (parm.Trade_Type > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Type` = :Trade_Type", "AND");
            }
            if (parm.Trade_Type_Name) {
                parm.Trade_Type_Name = "%" + parm.Trade_Type_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Type_Name` LIKE :Trade_Type_Name", "AND");
            }
            if (parm.Trade_Amt_MIN >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Amt` >= :Trade_Amt_MIN", "AND");
            }
            if (parm.Trade_Amt_MAX >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Amt` <= :Trade_Amt_MAX", "AND");
            }
            if (parm.Trade_Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Trade_Order_No` = :Trade_Order_No", "AND");
            }
            if (parm.Remark) {
                parm.Remark = "%" + parm.Remark + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Remark` LIKE :Remark", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            if (parm.Create_IP) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_IP` = :Create_IP", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "Trade_ID",
                        "Family_ID",
                        "Family_Name",
                        "Related_User_ID",
                        "Related_User_NickName",
                        "Related_User_RealName",
                        "Related_Anchor_ID",
                        "Related_Anchor_NickName",
                        "Related_Anchor_RealName",
                        "Trade_Flag",
                        "Trade_Type",
                        "Trade_Type_Name",
                        "Trade_Amt",
                        "Trade_Order_No",
                        "Amt",
                        "Remark",
                        "Create_Date",
                        "Create_IP"
                    ]);
                    ThisValue.Related_User_RealName = KOC.StringUtils.Cover(ThisValue.Related_User_RealName, "Name");
                    ThisValue.Related_Anchor_RealName = KOC.StringUtils.Cover(ThisValue.Related_Anchor_RealName, "Name");
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        FamilyBankTrade_Parm: function () {
            return {
                FuzzyQuery: "",
                Trade_ID: 0,
                Family_ID: 0,
                Family_Name: "",
                Related_User_ID: 0,
                Related_User_NickName: "",
                Related_User_RealName: "",
                Related_Anchor_ID: 0,
                Related_Anchor_NickName: "",
                Related_Anchor_RealName: "",
                Trade_Flag: 0,
                Trade_Type: -1,
                Trade_Type_Name: "",
                Trade_Amt_MIN: -1,
                Trade_Amt_MAX: -1,
                Trade_Order_No: "",
                Remark: "",
                StartDate: "",
                EndDate: "",
                Create_IP: ""
            };
        },
        //endregion
        //region UserTask 用户任务分页列表
        UserTask: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`User_ID`";
            PageParm.ColumnMAX = "`User_ID`";
            PageParm.ColumnList = " * ";
            PageParm.TableList = "`user_task`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_RealName` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            if (parm.Task_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Task_ID` = :Task_ID", "AND");
            }
            if (parm.Task_Name) {
                parm.Task_Name = "%" + parm.Task_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Task_Name` LIKE :Task_Name", "AND");
            }
            //任务模式 ONE DAY WEEK MONTH YEAR 支持多选
            var _Task_Mode = [];
            KOC.Lodash.forEach(String(parm.Task_Mode).split(","), function (ThisValue) {
                if (KOC.Lodash.includes(["ONE", "DAY", "WEEK", "MONTH", "YEAR"], ThisValue)) {
                    _Task_Mode.push(ThisValue);
                }
            });
            if (_Task_Mode.length > 0) {
                parm.Task_Mode = _Task_Mode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Task_Mode` IN (:Task_Mode)", "AND");
            }
            //按任务时间查询,默认查任务时间是当天的
            var _Task_Date = [];
            if (parm.Task_Date && KOC.DateUtils.Valid(new Date(parm.Task_Date))) {
                parm.Task_Date = KOC.Moment(new Date(parm.Task_Date)).format("YYYYMMDD");
                if (parm.Task_Mode.length > 0) {
                    KOC.Lodash.forEach(parm.Task_Mode, function (ThisValue) {
                        switch (ThisValue) {
                            case "ONE":
                                parm.Task_Date = "";
                                break;
                            case "DAY":
                                parm.Task_Date = KOC.Moment(parm.Task_Date).format("YYYYMMDD");
                                break;
                            case "WEEK":
                                parm.Task_Date = KOC.Moment(parm.Task_Date).startOf("isoWeek").format("YYYYMMDD");
                                break;
                            case "MONTH":
                                parm.Task_Date = KOC.Moment(parm.Task_Date).startOf("month").format("YYYYMMDD");
                                break;
                            case "YEAR":
                                parm.Task_Date = KOC.Moment(parm.Task_Date).startOf("year").format("YYYYMMDD");
                                break;
                            default:
                                parm.Task_Date = KOC.Moment(parm.Task_Date).format("YYYYMMDD");
                                return;
                        }
                        _Task_Date.push(parm.Task_Date);
                    });
                    parm.Task_Date = _Task_Date;
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Task_Date` IN (:Task_Date)", "AND");
            }
            if (KOC.Lodash.includes([
                    "Create_Date"
                    , "Completion_Date"
                    , "Receive_Date"], parm.DateType)) {
                parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
                if (parm.StartDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`" + parm.DateType + "` >= :StartDate", "AND");
                }
                parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
                if (parm.EndDate) {
                    PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`" + parm.DateType + "` <= :EndDate", "AND");
                }
            }
            var _Status = [];
            KOC.Lodash.forEach(String(parm.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                parm.Status = _Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Status` IN (:Status)", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "User_ID",
                        "User_NickName",
                        "User_RealName",
                        "Task_ID",
                        "Task_Name",
                        "Task_Date",
                        "Task_Mode",
                        "Task_Progress",
                        "Task_Objective",
                        "Task_Reward",
                        "Completion_Date",
                        "Receive_Date",
                        "Create_Date",
                        "Create_IP",
                        "Status"
                    ]);
                    ThisValue.RealName = KOC.StringUtils.Cover(ThisValue.User_RealName, "Name");
                    ThisValue.Task_Reward = JSON.parse(ThisValue.Task_Reward);
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        UserTask_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: 0,
                User_NickName: "",
                User_RealName: "",
                Task_ID: 0,
                Task_Name: "",
                Task_Mode: "",
                Task_Date: "",
                DateType: "",
                StartDate: "",
                EndDate: "",
                Status: ""
            };
        },
        //endregion
        //region UserAdmin:管理员列表
        UserAdmin: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`User_ID`";
            PageParm.ColumnMAX = "`User_ID`";
            PageParm.ColumnList = "*";
            PageParm.TableList = "`user_admin`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`RealName` = :FuzzyQuery", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Phone` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            if (parm.RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`RealName` = :RealName", "AND");
            }
            if (parm.Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Phone` = :Phone", "AND");
            }
            if (parm.IsMaster >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`IsMaster` = :IsMaster", "AND");
            }
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            var _Status = [];
            KOC.Lodash.forEach(String(parm.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                parm.Status = _Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Status` IN (:Status)", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "User_ID",
                        "Phone",
                        "RealName",
                        "IsMaster",
                        "RightCode",
                        "Create_Date",
                        "Create_IP",
                        "Status"
                    ]);
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        UserAdmin_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: 0,
                RealName: "",
                Phone: "",
                IsMaster: -1,
                DateType: "",
                StartDate: "",
                EndDate: "",
                Status: ""
            };
        },
        //endregionrsesw
        //*******************************!!!!!!!改
        //region UserAnchorApply:艺人申请审批
        UserAnchorApply: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_info`.`User_ID`";
            PageParm.ColumnMAX = "`user_info`.`User_ID`";
            PageParm.ColumnList = "`user_info`.`User_ID`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`Email`" +
                ", `user_info`.`Phone`" +
                ", `user_info`.`QQ`" +
                ", `user_info`.`Sex`" +
                ", `user_info`.`Birthday`" +
                ", `user_info`.`Constellation`" +
                ", `user_info`.`EXP`" +
                ", `user_info`.`VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`Coin`" +
                ", `user_info`.`Coin_Today`" +
                ", `user_info`.`Coin_Week`" +
                ", `user_info`.`Coin_Month`" +
                ", `user_info`.`Coin_Year`" +
                ", `user_info`.`Coin_Total`" +
                ", `user_info`.`Beans`" +
                ", `user_info`.`Beans_Today`" +
                ", `user_info`.`Beans_Week`" +
                ", `user_info`.`Beans_Month`" +
                ", `user_info`.`Beans_Year`" +
                ", `user_info`.`Beans_Total`" +
                ", `user_info`.`Pomelo`" +
                ", `user_info`.`Fans`" +
                ", `user_info`.`Attention`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                ", `user_info`.`Charge_First`" +
                ", `user_info`.`Charge_First_Date`" +
                ", `user_info`.`Charge_First_Award`" +
                ", `user_info`.`Charge_Last_Date`" +
                ", `user_info`.`Login_Count`" +
                ", `user_info`.`Login_This_Date`" +
                ", `user_info`.`Login_This_IP`" +
                ", `user_info`.`Create_Date`" +
                ", `user_anchor`.`Family_Commission`" +
                ", `user_anchor`.`RoomName`" +
                ", `user_anchor`.`RoomWelcome`" +
                ", `user_anchor`.`Tags`" +
                ", `user_anchor`.`IDCard`" +
                ", `user_anchor`.`Account_BankName`" +
                ", `user_anchor`.`Account_BankFullName`" +
                ", `user_anchor`.`Account_RealName`" +
                ", `user_anchor`.`Account_CardNo`" +
                ", `user_anchor`.`Live`" +
                ", `user_anchor`.`Family_ID` AS `Anchor_Family_ID`" +
                ", `user_anchor`.`Live_StartTime`" +
                ", `user_anchor`.`Live_Order_No`" +
                ", `user_anchor`.`Live_Duration_Total`" +
                ", `user_anchor`.`Email` AS `Anchor_Email`" +
                ", `user_anchor`.`Phone` AS `Anchor_Phone`" +
                ", `user_anchor`.`Pomelo` AS `Anchor_Pomelo`" +
                ", `user_anchor`.`Pomelo_Today` AS `Anchor_Pomelo_Today`" +
                ", `user_anchor`.`Pomelo_Week` AS `Anchor_Pomelo_Week`" +
                ", `user_anchor`.`Pomelo_Month` AS `Anchor_Pomelo_Month`" +
                ", `user_anchor`.`Pomelo_Year` AS `Anchor_Pomelo_Year`" +
                ", `user_anchor`.`EXP` AS `Anchor_EXP`" +
                ", `user_anchor`.`Create_Date` AS `Anchor_Create_Date`" +
                ", `user_anchor`.`Status` AS `Anchor_Status`" +
                ", IFNULL(`user_anchor_hot`.`Value`, 0) AS `Anchor_HotValue`" +
                ", IFNULL(`user_anchor_hot`.`Value_Previous`, 0) AS `Anchor_HotValue_Previous`" +
                ", IFNULL(`user_anchor_hot`.`Value_Ranking_Previous`, 0) AS `Anchor_HotValue_Ranking_Previous`" +
                ", CASE `user_anchor_hot`.`Value_Ranking_Previous` WHEN 1 THEN 1 ELSE 0 END AS `Anchor_HotValue_Champion_Previous`" +
                ", IFNULL(`order_live`.`Coin`, 0) AS `Live_Coin`" +
                ", IFNULL(`order_live`.`Gift_Num`, 0) AS `Gift_Num`" +
                ", IFNULL(`order_live`.`Gift_Num_Anchor`, 0) AS `Gift_Num_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Num_User`, 0) AS `Gift_Num_User`" +
                ", IFNULL(`order_live`.`Gift_Count`, 0) AS `Gift_Count`" +
                ", IFNULL(`order_live`.`Gift_Count_Anchor`, 0) AS `Gift_Count_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Count_User`, 0) AS `Gift_Count_User`" +
                ", IFNULL(`order_live`.`Gift_Coin`, 0) AS `Gift_Coin`" +
                ", IFNULL(`order_live`.`Gift_Coin_Anchor`, 0) AS `Gift_Coin_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Coin_User`, 0) AS `Gift_Coin_User`" +
                ", IFNULL(`order_live`.`Gift_Beans_Anchor`, 0) AS `Gift_Beans_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Beans_Family`, 0) AS `Gift_Beans_Family`" +
                ", IFNULL(`order_live`.`Gift_Beans_User`, 0) AS `Gift_Beans_User`" +
                ", IFNULL(`order_live`.`Gift_Beans_UserFamily`, 0) AS `Gift_Beans_UserFamily`" +
                ", IFNULL(`order_live`.`Gift_Beans_Platform`, 0) AS `Gift_Beans_Platform`" +
                ", IFNULL(`order_live`.`Gift_Pond_Count`, 0) AS `Gift_Pond_Count`" +
                ", IFNULL(`order_live`.`Gift_Pond_Coin`, 0) AS `Gift_Pond_Coin`" +
                ", IFNULL(`order_live`.`Gift_Pond_Coin`, 0) AS `Gift_Pond_Coin`" +
                ", IFNULL(`order_live`.`Guardian_Count`, 0) AS `Guardian_Count`" +
                ", IFNULL(`order_live`.`Guardian_Coin`, 0) AS `Guardian_Coin`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Anchor`, 0) AS `Guardian_Beans_Anchor`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Family`, 0) AS `Guardian_Beans_Family`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Platform`, 0) AS `Guardian_Beans_Platform`" +
                ", IFNULL(`order_live`.`Pomelo`, 0) AS `Live_Pomelo`" +
                ", IFNULL(`order_live`.`Duration`, 0) AS `Live_Duration`" +
                ", `order_live`.`Create_Date` AS `Live_Create_Date`" +
                ", IFNULL(`order_live`.`Status`, 0) AS `Live_Status`";
            PageParm.TableList = "`user_info` JOIN `user_anchor`" +
                " ON `user_info`.`User_ID` = `user_anchor`.`User_ID`" +
                " LEFT JOIN `user_anchor_hot`" +
                " ON `user_anchor`.`User_ID` = `user_anchor_hot`.`User_ID`" +
                " LEFT JOIN `order_live` ON `user_anchor`.`Live_Order_No` = `order_live`.`Order_No`";
            PageParm.Condition = "`user_info`.`Status` = 0 ";
            //PageParm.Condition = "`user_info`.`Status` = 0 AND `user_info`.`IsAnchor` = 1";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Phone` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Email` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`RoomName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`Tags` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery) > 0) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Phone` = :Phone", "AND");
            }
            if (parm.Email) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Email` = :Email", "AND");
            }
            if (parm.NickName) {
                parm.NickName = "%" + parm.NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`NickName` LIKE :NickName", "AND");
            }
            if (parm.Sex > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Sex` = :Sex", "AND");
            }
            if (parm.RoomName) {
                parm.RoomName = "%" + parm.RoomName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`RoomName` LIKE :RoomName", "AND");
            }
            if (parm.Tags) {
                parm.Tags = "%" + parm.Tags + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Tags` LIKE :Tags", "AND");
            }
            if (parm.Live) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_live`.`Status` = 1", "AND");
            }
            if (parm.IsFamily >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`IsFamily` = :IsFamily", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Family_ID` = :Family_ID", "AND");
            }
            var _Status = [];
            KOC.Lodash.forEach(String(parm.Status).split(","), function (ThisValue) {
                if (KOC.StringUtils.ToInt(ThisValue, -1) >= 0) {
                    _Status.push(ThisValue);
                }
            });
            if (_Status.length > 0) {
                parm.Status = _Status;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Status` IN (:Status)", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        UserAnchorApply_Parm: function () {
            return {
                FuzzyQuery: "",
                Phone: "",
                Email: "",
                NickName: "",
                Sex: -1,
                RoomName: "",
                Tags: "",
                Live: false,
                IsFamily: -1,
                Family_ID: -1,
                Status: "0"
            };
        },
        //endregion
        //region UserAttention:用户关注列表
        UserAttention: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            //排序处理，直播优先，
            PageParm.OrderName = "Live DESC," + page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_info`.`User_ID`";
            PageParm.ColumnMAX = "`user_info`.`User_ID`";
            PageParm.ColumnList = "`user_attention`.`Create_Date`" +
                ", `user_info`.`User_ID`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`Email`" +
                ", `user_info`.`Phone`" +
                ", `user_info`.`QQ`" +
                ", `user_info`.`Sex`" +
                ", `user_info`.`Birthday`" +
                ", `user_info`.`Constellation`" +
                ", `user_info`.`EXP`" +
                ", `user_info`.`VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`Beans`" +
                ", `user_info`.`Pomelo`" +
                ", `user_info`.`Fans`" +
                ", `user_info`.`Attention`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                ", `user_info`.`Login_Count`" +
                ", `user_info`.`Login_This_Date`" +
                ", `user_info`.`Create_Date` AS `User_Create_Date`" +
                ", IFNULL(`user_anchor`.`Family_Commission`, 0) AS `Family_Commission`" +
                ", IFNULL(`user_anchor`.`RoomName`, '') AS `RoomName`" +
                ", IFNULL(`user_anchor`.`RoomWelcome`, '') AS `RoomWelcome`" +
                ", IFNULL(`user_anchor`.`Tags`, '') AS `Tags`" +
                ", IFNULL(`user_anchor`.`Live`, 0) AS `Live`" +
                ", `user_anchor`.`Live_StartTime` AS `Live_StartTime`" +
                ", `user_anchor`.`Live_Order_No` AS `Live_Order_No`" +
                ", IFNULL(`user_anchor`.`Live_Duration_Total`, 0) AS `Live_Duration_Total`" +
                ", IFNULL(`user_anchor`.`Pomelo`, 0) AS `Anchor_Pomelo`" +
                ", IFNULL(`user_anchor`.`EXP`, 0) AS `Anchor_EXP`" +
                ", IFNULL(`user_anchor`.`HotValue`, 0) AS `Anchor_HotValue`" +
                ", `user_anchor`.`Create_Date` AS `Anchor_Create_Date`" +
                ", IFNULL(`order_live`.`Coin`, 0) AS `Live_Coin`" +
                ", IFNULL(`order_live`.`IsMobile`, 0) AS `Live_IsMobile`" +
                ", IFNULL(`order_live`.`Gift_Num`, 0) AS `Gift_Num`" +
                ", IFNULL(`order_live`.`Gift_Num_Anchor`, 0) AS `Gift_Num_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Num_User`, 0) AS `Gift_Num_User`" +
                ", IFNULL(`order_live`.`Gift_Count`, 0) AS `Gift_Count`" +
                ", IFNULL(`order_live`.`Gift_Count_Anchor`, 0) AS `Gift_Count_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Count_User`, 0) AS `Gift_Count_User`" +
                ", IFNULL(`order_live`.`Gift_Coin`, 0) AS `Gift_Coin`" +
                ", IFNULL(`order_live`.`Gift_Coin_Anchor`, 0) AS `Gift_Coin_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Coin_User`, 0) AS `Gift_Coin_User`" +
                ", IFNULL(`order_live`.`Gift_Beans_Anchor`, 0) AS `Gift_Beans_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Beans_Family`, 0) AS `Gift_Beans_Family`" +
                ", IFNULL(`order_live`.`Gift_Beans_User`, 0) AS `Gift_Beans_User`" +
                ", IFNULL(`order_live`.`Gift_Beans_UserFamily`, 0) AS `Gift_Beans_UserFamily`" +
                ", IFNULL(`order_live`.`Gift_Beans_Platform`, 0) AS `Gift_Beans_Platform`" +
                ", IFNULL(`order_live`.`Gift_Pond_Count`, 0) AS `Gift_Pond_Count`" +
                ", IFNULL(`order_live`.`Gift_Pond_Coin`, 0) AS `Gift_Pond_Coin`" +
                ", IFNULL(`order_live`.`Gift_Pond_Coin`, 0) AS `Gift_Pond_Coin`" +
                ", IFNULL(`order_live`.`Guardian_Count`, 0) AS `Guardian_Count`" +
                ", IFNULL(`order_live`.`Guardian_Coin`, 0) AS `Guardian_Coin`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Anchor`, 0) AS `Guardian_Beans_Anchor`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Family`, 0) AS `Guardian_Beans_Family`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Platform`, 0) AS `Guardian_Beans_Platform`" +
                ", IFNULL(`order_live`.`Pomelo`, 0) AS `Live_Pomelo`" +
                ", IFNULL(`order_live`.`Duration`, 0) AS `Live_Duration`" +
                ", `order_live`.`Create_Date` AS `Live_Create_Date`" +
                ", IFNULL(`order_live`.`Status`, 0) AS `Live_Status`";
            PageParm.TableList = "`user_attention` JOIN `user_info`" +
                " ON `user_attention`.`User_ID_Attention` = `user_info`.`User_ID`" +
                " LEFT JOIN `user_anchor` ON `user_info`.`User_ID` = `user_anchor`.`User_ID`" +
                " LEFT JOIN `order_live` ON `user_anchor`.`Live_Order_No` = `order_live`.`Order_No`" +
                " AND `user_anchor`.`Status` = 0";
            PageParm.Condition = "`user_attention`.`User_ID` = :User_ID AND `user_info`.`Status` = 0";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Phone` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Email` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Phone` = :Phone", "AND");
            }
            if (parm.Email) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Email` = :Email", "AND");
            }
            if (parm.NickName) {
                parm.NickName = "%" + parm.NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`NickName` LIKE :NickName", "AND");
            }
            if (parm.Sex > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Sex` = :Sex", "AND");
            }
            if (parm.IsAnchor >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`IsAnchor` = :IsAnchor", "AND");
            }
            if (parm.IsFamily >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`IsFamily` = :IsFamily", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Family_ID` = :Family_ID", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        UserAttention_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: -1,
                Phone: "",
                Email: "",
                NickName: "",
                Sex: -1,
                RoomName: "",
                Tags: "",
                Live: false,
                IsFamily: -1,
                Family_ID: -1,
                Status: "0"
            };
        },
        //endregion
        //region UserAnchorFans:艺人粉丝列表
        UserAnchorFans: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            //排序处理，直播优先，
            PageParm.OrderName = "Live DESC," + page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_info`.`User_ID`";
            PageParm.ColumnMAX = "`user_info`.`User_ID`";
            PageParm.ColumnList = "`user_attention`.`Create_Date`" +
                ", `user_info`.`User_ID`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`Email`" +
                ", `user_info`.`Phone`" +
                ", `user_info`.`QQ`" +
                ", `user_info`.`Sex`" +
                ", `user_info`.`Birthday`" +
                ", `user_info`.`Constellation`" +
                ", `user_info`.`EXP`" +
                ", `user_info`.`VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`Beans`" +
                ", `user_info`.`Pomelo`" +
                ", `user_info`.`Fans`" +
                ", `user_info`.`Attention`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                ", `user_info`.`Login_Count`" +
                ", `user_info`.`Login_This_Date`" +
                ", `user_info`.`Create_Date` AS `User_Create_Date`" +
                ", `user_contribution`.`Coin`" +
                ", `user_contribution`.`Coin_Live`" +
                ", `user_contribution`.`Coin_Day`" +
                ", `user_contribution`.`Coin_Week`" +
                ", `user_contribution`.`Coin_Month`" +
                ", `user_contribution`.`Coin_Year`" +
                ", IFNULL(`user_anchor`.`Family_Commission`, 0) AS `Family_Commission`" +
                ", IFNULL(`user_anchor`.`RoomName`, '') AS `RoomName`" +
                ", IFNULL(`user_anchor`.`RoomWelcome`, '') AS `RoomWelcome`" +
                ", IFNULL(`user_anchor`.`Tags`, '') AS `Tags`" +
                ", IFNULL(`user_anchor`.`Live`, 0) AS `Live`" +
                ", `user_anchor`.`Live_StartTime` AS `Live_StartTime`" +
                ", `user_anchor`.`Live_Order_No` AS `Live_Order_No`" +
                ", IFNULL(`user_anchor`.`Live_Duration_Total`, 0) AS `Live_Duration_Total`" +
                ", IFNULL(`user_anchor`.`Pomelo`, 0) AS `Anchor_Pomelo`" +
                ", IFNULL(`user_anchor`.`EXP`, 0) AS `Anchor_EXP`" +
                ", IFNULL(`user_anchor`.`HotValue`, 0) AS `Anchor_HotValue`" +
                ", `user_anchor`.`Create_Date` AS `Anchor_Create_Date`" +
                ", IFNULL(`order_live`.`Coin`, 0) AS `Live_Coin`" +
                ", IFNULL(`order_live`.`IsMobile`, 0) AS `Live_IsMobile`" +
                ", IFNULL(`order_live`.`Gift_Num`, 0) AS `Gift_Num`" +
                ", IFNULL(`order_live`.`Gift_Num_Anchor`, 0) AS `Gift_Num_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Num_User`, 0) AS `Gift_Num_User`" +
                ", IFNULL(`order_live`.`Gift_Count`, 0) AS `Gift_Count`" +
                ", IFNULL(`order_live`.`Gift_Count_Anchor`, 0) AS `Gift_Count_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Count_User`, 0) AS `Gift_Count_User`" +
                ", IFNULL(`order_live`.`Gift_Coin`, 0) AS `Gift_Coin`" +
                ", IFNULL(`order_live`.`Gift_Coin_Anchor`, 0) AS `Gift_Coin_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Coin_User`, 0) AS `Gift_Coin_User`" +
                ", IFNULL(`order_live`.`Gift_Beans_Anchor`, 0) AS `Gift_Beans_Anchor`" +
                ", IFNULL(`order_live`.`Gift_Beans_Family`, 0) AS `Gift_Beans_Family`" +
                ", IFNULL(`order_live`.`Gift_Beans_User`, 0) AS `Gift_Beans_User`" +
                ", IFNULL(`order_live`.`Gift_Beans_UserFamily`, 0) AS `Gift_Beans_UserFamily`" +
                ", IFNULL(`order_live`.`Gift_Beans_Platform`, 0) AS `Gift_Beans_Platform`" +
                ", IFNULL(`order_live`.`Gift_Pond_Count`, 0) AS `Gift_Pond_Count`" +
                ", IFNULL(`order_live`.`Gift_Pond_Coin`, 0) AS `Gift_Pond_Coin`" +
                ", IFNULL(`order_live`.`Gift_Pond_Coin`, 0) AS `Gift_Pond_Coin`" +
                ", IFNULL(`order_live`.`Guardian_Count`, 0) AS `Guardian_Count`" +
                ", IFNULL(`order_live`.`Guardian_Coin`, 0) AS `Guardian_Coin`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Anchor`, 0) AS `Guardian_Beans_Anchor`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Family`, 0) AS `Guardian_Beans_Family`" +
                ", IFNULL(`order_live`.`Guardian_Beans_Platform`, 0) AS `Guardian_Beans_Platform`" +
                ", IFNULL(`order_live`.`Pomelo`, 0) AS `Live_Pomelo`" +
                ", IFNULL(`order_live`.`Duration`, 0) AS `Live_Duration`" +
                ", `order_live`.`Create_Date` AS `Live_Create_Date`" +
                ", IFNULL(`order_live`.`Status`, 0) AS `Live_Status`";
            PageParm.TableList = "`user_attention` JOIN `user_info`" +
                " ON `user_attention`.`User_ID` = `user_info`.`User_ID`" +
                " LEFT JOIN `user_anchor` ON `user_info`.`User_ID` = `user_anchor`.`User_ID`" +
                " LEFT JOIN `user_contribution` ON `user_info`.`User_ID` = `user_contribution`.`User_ID`" +
                " AND `user_contribution`.`User_ID_Contribution` = :User_ID_Attention" +
                " LEFT JOIN `order_live` ON `user_anchor`.`Live_Order_No` = `order_live`.`Order_No`" +
                " AND `user_anchor`.`Status` = 0";
            PageParm.Condition = "`user_attention`.`User_ID_Attention` = :User_ID_Attention AND `user_info`.`Status` = 0";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Phone` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Email` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Phone` = :Phone", "AND");
            }
            if (parm.Email) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Email` = :Email", "AND");
            }
            if (parm.NickName) {
                parm.NickName = "%" + parm.NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`NickName` LIKE :NickName", "AND");
            }
            if (parm.Sex > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`Sex` = :Sex", "AND");
            }
            if (parm.IsAnchor >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`IsAnchor` = :IsAnchor", "AND");
            }
            if (parm.IsFamily >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`IsFamily` = :IsFamily", "AND");
            }
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor`.`Family_ID` = :Family_ID", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        UserAnchorFans_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: -1,
                Phone: "",
                Email: "",
                NickName: "",
                Sex: -1,
                RoomName: "",
                Tags: "",
                Live: false,
                IsFamily: -1,
                Family_ID: -1,
                Status: "0"
            };
        },
        //endregion
        //region UserAnchorCover: 艺人海报列表
        UserAnchorCover: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_anchor_cover`.`User_ID`";
            PageParm.ColumnMAX = "`user_anchor_cover`.`User_ID`";
            PageParm.ColumnList = "`user_anchor_cover`.`User_ID`" +
                ", `user_anchor_cover`.`Type`" +
                ", `user_anchor_cover`.`NickName`" +
                ", `user_anchor_cover`.`Image`" +
                ", `user_anchor_cover`.`Create_Date`" +
                ", `user_anchor_cover`.`Create_IP`" +
                ", `user_anchor_cover`.`Status`";
            PageParm.TableList = "`user_anchor_cover`";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor_cover`.`User_ID` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor_cover`.`NickName` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor_cover`.`User_ID` = :User_ID", "AND");
            }
            if (parm.Type) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor_cover`.`Type` = :Type", "AND");
            }
            if (parm.NickName) {
                parm.NickName = "%" + parm.NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor_cover`.`NickName` LIKE :NickName", "AND");
            }
            if (parm.Status == 0 || parm.Status == 1 || parm.Status == 2) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_anchor_cover`.`Status` = :Status", "AND");
            }
            //按创建日期查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "DATE_FORMAT(`user_anchor_cover`.`Create_Date`,'%Y-%m-%d') >= :Create_Date_Between AND DATE_FORMAT(`user_anchor_cover`.`Create_Date`,'%Y-%m-%d') <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        UserAnchorCover_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                User_ID: -1,//用户ID
                NickName: null,//用户昵称
                Create_Date_Between: null,//从...
                Create_Date_And: null,//到.....
                Status: null//状态,0:已通过，1-未审核，2-未通过
            };
        },
        //endregion
        //region UserDayStatistics:每日用户统计列表
        UserDayStatistics: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_day_statistics`.`ID`";
            PageParm.ColumnMAX = "`user_day_statistics`.`ID`";
            PageParm.ColumnList = "`user_day_statistics`.`ID`" +
                ", `user_day_statistics`.`UV`" +
                ", `user_day_statistics`.`Regist_Day_Number`" +
                ", `user_day_statistics`.`Registration_Conversion`" +
                ", `user_day_statistics`.`Login_Day_User`" +
                ", `user_day_statistics`.`Regist_Total_User`" +
                ", `user_day_statistics`.`Actrate`" +
                ", `user_day_statistics`.`Max_Online_User`" +
                ", `user_day_statistics`.`Recharge_Day_User`" +
                ", `user_day_statistics`.`Recharge_Day_Coin`" +
                ", `user_day_statistics`.`Recharge_Total_User`" +
                ", `user_day_statistics`.`Recharge_Total_Coin`" +
                ", `user_day_statistics`.`Pay_Day_User`" +
                ", `user_day_statistics`.`Pay_Day_Coin`" +
                ", `user_day_statistics`.`ARPU`" +
                ", `user_day_statistics`.`Create_Date`" +
                ", `user_day_statistics`.`Web_IP_Number`";
            PageParm.TableList = "`user_day_statistics`";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            //按ID查询
            if (parm.ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_day_statistics`.`ID` = :ID", "AND");
            }
            //按创建日期查询
            if (parm.Create_Date) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_day_statistics`.`Create_Date` = :Create_Date", "AND");
            }
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_day_statistics`.`Create_Date` >= :Create_Date_Between AND `user_day_statistics`.`Create_Date` < :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        UserDayStatistics_Parm: function () {
            return {
                ID: null,//ID
                Create_Date: null,//创建时间
                Create_Date_Between: null,//从....
                Create_Date_And: null//到....
            };
        },
        //endregion
        //region UserFeedBack:意见反馈列表
        UserFeedBack: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_feedback`.`ID`";
            PageParm.ColumnMAX = "`user_feedback`.`ID`";
            PageParm.ColumnList = "`user_feedback`.`ID`" +
                ", `user_feedback`.`User_ID`" +
                ", `user_feedback`.`Relate_User_ID`" +
                ", `user_feedback`.`Relate_NickName`" +
                ", `user_feedback`.`Type`" +
                ", `user_feedback`.`QQ`" +
                ", `user_feedback`.`Message`" +
                ", `user_feedback`.`Create_Date`" +
                ", `user_feedback`.`Create_IP`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`Phone`";
            PageParm.TableList = "`user_feedback` JOIN `user_info`" +
                " ON `user_feedback`.`User_ID` = `user_info`.`User_ID`";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_feedback`.`ID` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_feedback`.`User_ID` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            //按ID查询
            if (parm.ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_feedback`.`ID` = :ID", "AND");
            }
            //按User_ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_feedback`.`User_ID` = :User_ID", "AND");
            }
            //按NickName查询
            if (parm.NickName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`NickName` LIKE :NickName", "AND");
            }
            if (parm.QQ) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_feedback`.`QQ` LIKE :QQ", "AND");
            }
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "DATE_FORMAT(`user_feedback`.`Create_Date`,'%Y-%m-%d') >= :Create_Date_Between AND DATE_FORMAT(`user_feedback`.`Create_Date`,'%Y-%m-%d') <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        UserFeedBack_Parm: function () {
            return {
                FuzzyQuery: "",
                ID: null,//ID
                User_ID: null,//ID
                NickName: null,//ID
                Create_Date: null,//创建时间
                Create_Date_Between: null,//从....
                Create_Date_And: null//到....
            };
        },
        //endregion
        //region UserAdminOld:管理员列表
        UserAdminOld: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_admin`.`User_ID`";
            PageParm.ColumnMAX = "`user_admin`.`User_ID`";
            PageParm.ColumnList = "`user_admin`.`User_ID`" +
                ", `user_admin`.`RealName`" +
                ", `user_admin`.`RealName`" +
                ", `user_admin`.`Phone`" +
                ", `user_admin`.`IsMaster`" +
                ", `user_admin`.`RightCode`" +
                ", `user_admin`.`Create_Date`" +
                ", `user_admin`.`Status`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`Login_Count`" +
                ", `user_info`.`Login_Last_Date`" +
                ", `user_info`.`IsAdmin`" +
                ", `user_admin`.`Create_IP`";
            PageParm.TableList = "`user_admin` JOIN `user_info`" +
                " ON `user_admin`.`User_ID` = `user_info`.`User_ID`";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_admin`.`User_ID` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_admin`.`RealName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_admin`.`Phone` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            //按User_ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_admin`.`User_ID` = :User_ID", "AND");
            }
            //按NickName查询
            if (parm.NickName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`RealName` LIKE :NickName", "AND");
            }
            //按RealName查询
            if (parm.RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_admin`.`RealName` LIKE :RealName", "AND");
            }
            //按Phone查询
            if (parm.Phone) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_admin`.`Phone` = :Phone", "AND");
            }
            //按Status查询
            if (parm.Status == 0 || parm.Status == 1) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_admin`.`Status` = :Status", "AND");
            }
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_admin`.`Create_Date` >= :Create_Date_Between AND `user_admin`.`Create_Date` <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        UserAdminOld_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: null,//ID
                RealName: null,//真实姓名
                Phone: null,//手机号
                Status: null,//状态
                Create_Date: null,//创建时间
                Create_Date_Between: null,//从....
                Create_Date_And: null//到....
            };
        },
        //endregionrsesw
        //region User_Item_Grant:物品发放类表
        User_Item_Grant: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col && page.Sort_Dir ? page.Sort_Col + " " + page.Sort_Dir : "";
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`user_item_grant`.`ID`";
            PageParm.ColumnMAX = "`user_item_grant`.`User_ID`";
            PageParm.ColumnList = "`user_item_grant`.`ID`" +
                ", `user_item_grant`.`User_ID`" +
                ", `user_item_grant`.`User_NickName`" +
                ", `user_item_grant`.`Item_Type`" +
                ", `user_item_grant`.`Item_ID`" +
                ", `user_item_grant`.`Item_Name`" +
                ", `user_item_grant`.`Num`" +
                ", `user_item_grant`.`Item_Expire`" +
                ", `user_item_grant`.`Remark`" +
                ", `user_item_grant`.`Create_Date`" +
                ", `user_item_grant`.`Create_IP`";

            PageParm.TableList = "`user_item_grant`";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_item_grant`.`User_NickName` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery) > 0) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_item_grant`.`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按用户ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_item_grant`.`User_ID` = :User_ID", "AND");
            }
            //按用户交易号
            if (parm.ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_item_grant`.`ID` = :ID", "AND");
            }
            //按用户昵称查询
            if (parm.User_NickName) {
                parm.User_NickName = '%' + parm.User_NickName + '%';
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_item_grant`.`User_NickName` LIKE :User_NickName", "AND");
            }
            //按支付类型查询
            if (parm.Item_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_item_grant`.`Item_ID` = :Item_ID", "AND");
            }

            //按创建日期查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "DATE_FORMAT(`user_item_grant`.`Create_Date`,'%Y-%m-%d') >= :Create_Date_Between AND DATE_FORMAT(`user_item_grant`.`Create_Date`,'%Y-%m-%d') <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        User_Item_Grant_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                User_NickName: null,//用户昵称
                User_ID: null,//交易号
                Create_Date_Between: null,//查询下订单时间的开始时间
                Create_Date_And: null,//查询下订单时间的结束时间
            };
        },
        //endregion
        //region OrderGiftOld:用户购买礼物列表
        OrderGiftOld: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col && page.Sort_Dir ? page.Sort_Col + " " + page.Sort_Dir : "";
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_gift`.`Order_No`";
            PageParm.ColumnMAX = "`order_gift`.`User_ID`";
            PageParm.ColumnList = "`order_gift`.`Order_No`" +
                ", `order_gift`.`Live_Order_No`" +
                ", `order_gift`.`User_ID_Anchor`" +
                ", `order_gift`.`User_ID`" +
                ", `order_gift`.`User_NickName`" +
                ", `order_gift`.`User_ID_Gift`" +
                ", `order_gift`.`User_NickName_Gift`" +
                ", `order_gift`.`Family_ID`" +
                ", `order_gift`.`Family_Name`" +
                ", `order_gift`.`Gift_ID`" +
                ", `order_gift`.`Gift_Name`" +
                ", `order_gift`.`Gift_Price`" +
                ", `order_gift`.`Order_Num`" +
                ", `order_gift`.`Order_Amt`" +
                ", `order_gift`.`Commission_Gift_Family`" +
                ", `order_gift`.`Commission_Gift_Anchor`" +
                ", `order_gift`.`Commission_Anchor_Family`" +
                ", `order_gift`.`Order_Amt_Anchor`" +
                ", `order_gift`.`Order_Amt_Platform`" +
                ", `order_gift`.`Order_Amt_Family`" +
                ", `order_gift`.`Create_Date`";
            PageParm.TableList = "`order_gift`";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_gift`.`Live_Order_No` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_gift`.`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_gift`.`User_NickName_Gift` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_gift`.`Gift_Name` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery) > 0) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_gift`.`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //用户ID，查我送出的礼物列表
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`User_ID` = :User_ID", "AND");
            }
            //按直播单号查询
            if (parm.Live_Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`Live_Order_No` = :Live_Order_No", "AND");
            }
            //按用户ID(艺人，房间)查询,艺人收到的礼物列表
            if (parm.User_ID_Anchor) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`User_ID_Anchor` = :User_ID_Anchor", "AND");
            }
            //按用户昵称(送出人)查询
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`User_NickName` LIKE :User_NickName", "AND");
            }
            //按用户ID(接收人)查询
            if (parm.User_ID_Gift) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`User_ID_Gift` = :User_ID_Gift", "AND");
            }
            //按用户昵称(接收人)查询
            if (parm.User_NickName_Gift) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`User_NickName_Gift` LIKE :User_NickName_Gift", "AND");
            }
            //按公会ID(接收人)查询
            if (parm.Family_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`Family_ID` = :Family_ID", "AND");
            }
            //按公会名(被守护人)查询
            if (parm.Family_Name) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`Family_Name` LIKE :Family_Name", "AND");
            }
            //按礼物商品ID查询
            if (parm.Gift_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`Gift_ID` = :Gift_ID", "AND");
            }
            //按礼物商品名称查询
            if (parm.Gift_Name) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_gift`.`Gift_Name` LIKE :Gift_Name", "AND");
            }
            //按创建时间时间查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "DATE_FORMAT(`order_gift`.`Create_Date`,'%Y-%m-%d') >= :Create_Date_Between AND DATE_FORMAT(`order_gift`.`Create_Date`,'%Y-%m-%d') <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderGiftOld_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                Live_Order_No: null,//直播单据号
                User_ID_Anchor: null,//用户ID(艺人，房间)
                User_NickName: null,//用户昵称(送出人)
                User_ID_Gift: null,//用户ID(接收人)
                User_NickName_Gift: null,//用户昵称(接收人)
                Family_ID: null,//公会ID(接收人)
                Family_Name: null,//公会名(接收人)
                Gift_ID: null,//礼物商品ID
                Gift_Name: null,//礼物商品名称
                Create_Date_Between: null,//查询的开始时间
                Create_Date_And: null//查询的结束时间
            };
        },
        //endregion
        //region OrderGuardianOld:用户购买守护列表
        OrderGuardianOld: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col && page.Sort_Dir ? page.Sort_Col + " " + page.Sort_Dir : "";
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_guardian`.`Order_No`";
            PageParm.ColumnMAX = "`order_guardian`.`User_ID`";
            PageParm.ColumnList = "`order_guardian`.`Order_No`" +
                ", `order_guardian`.`Live_Order_No`" +
                ", `order_guardian`.`User_ID`" +
                ", `order_guardian`.`User_NickName`" +
                ", `order_guardian`.`User_ID_Guardian`" +
                ", `order_guardian`.`User_NickName_Guardian`" +
                ", `order_guardian`.`Family_ID`" +
                ", `order_guardian`.`Family_Name`" +
                ", `order_guardian`.`Guardian_ID`" +
                ", `order_guardian`.`Guardian_Name`" +
                ", `order_guardian`.`Guardian_Mode`" +
                ", `order_guardian`.`Guardian_Value`" +
                ", `order_guardian`.`Order_Amt`" +
                ", `order_guardian`.`Create_Date`";
            PageParm.TableList = "`order_guardian`";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "`Create_Date`" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`Live_Order_No` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`User_NickName_Guardian` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`Family_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`Guardian_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`Guardian_Mode` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按我的守护的列表查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_guardian`.`User_ID` = :User_ID", "AND");
            }
            //按直播单号查询
            if (parm.Live_Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_guardian`.`Live_Order_No` = :Live_Order_No", "AND");
            }
            //按被守护人用户ID查询
            if (parm.User_ID_Guardian) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_guardian`.`User_ID_Guardian` = :User_ID_Guardian", "AND");
            }
            //按被守护人公会ID查询
            if (parm.Family_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_guardian`.`Family_ID` = :Family_ID", "AND");
            }
            //按守户商品ID查询
            if (parm.Guardian_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_guardian`.`Guardian_ID` = :Guardian_ID", "AND");
            }
            //按守户模式查询
            if (parm.Guardian_Mode) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_guardian`.`Guardian_Mode` LIKE :Guardian_Mode", "AND");
            }
            //按创建时间时间查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_guardian`.`Create_Date` >= :Create_Date_Between AND `order_guardian`.`Create_Date` <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderGuardianOld_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                Live_Order_No: null,//直播单号查询
                User_ID_Guardian: null,//用户ID(被守护人)
                User_NickName_Guardian: null,//用户名称(被守护人)
                Family_ID: null,//公会ID(被守护人)
                Family_Name: null,//公会名称(被守护人)
                Guardian_ID: null,//守户商品ID
                Guardian_Name: null,//守户商品名称
                Guardian_Mode: null,//守户模式：YEAR, MONTY, WEEK, DAY
                Create_Date_Between: null,//查询的开始时间
                Create_Date_And: null,//查询的结束时间
                User_NickName: null,//用户名称(守护人)
                User_ID: -1
            };
        },
        //endregion
        //region OrderAnchorIntegralOld:艺人罚分列表
        OrderAnchorIntegralOld: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`Order_No`";
            PageParm.ColumnMAX = "`Order_No`";
            PageParm.ColumnList = " * ";
            PageParm.TableList = "`order_anchorintegral`";
            PageParm.Condition = "";
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_RealName` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_NickName_Admin` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_RealName_Admin` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Type` = :FuzzyQuery", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Remark` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery)) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Order_No` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`User_ID_Admin` = :FuzzyQuery", "OR");
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`Family_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按艺人ID查询
            if (parm.User_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID` = :User_ID", "AND");
            }
            //按艺人昵称查询
            if (parm.User_NickName) {
                parm.User_NickName = "%" + parm.User_NickName + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName` LIKE :User_NickName", "AND");
            }
            //按艺人真实姓名查询
            if (parm.User_RealName) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName` = :User_RealName", "AND");
            }
            //按管理员ID查询(操作人)
            if (parm.User_ID_Admin > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_ID_Admin` = :User_ID_Admin", "AND");
            }
            //按管理员昵称查询(操作人)
            if (parm.User_NickName_Admin) {
                parm.User_NickName_Admin = "%" + parm.User_NickName_Admin + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_NickName_Admin` LIKE :User_NickName_Admin", "AND");
            }
            //按管理员真实姓名查询(操作人)
            if (parm.User_RealName_Admin) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`User_RealName_Admin` = :User_RealName_Admin", "AND");
            }
            //按公会ID查询(被操作人)
            if (parm.Family_ID > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_ID` = :Family_ID", "AND");
            }
            //按公会名称查询(被操作人)
            if (parm.Family_Name) {
                parm.Family_Name = "%" + parm.Family_Name + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Family_Name` LIKE :Family_Name", "AND");
            }
            //按分数查询
            if (parm.Integral > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Integral` = :Integral", "AND");
            }
            //按艺人罚分查询(开始分数)
            if (parm.Start_Integral > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Integral` >= :Start_Integral", "AND");
            }
            //按艺人罚分查询(结束分数)
            if (parm.End_Integral > 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Integral` <= :End_Integral", "AND");
            }
            //按类型查询
            if (parm.Type) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Type` = :Type", "AND");
            }
            //按操作类型查询(0-警告,1-结束直播,2-冻结房间)
            if (parm.Operation >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Operation` = :Operation", "AND");
            }
            //按通知类型(0-默认不通知,1-通知艺人自己,2-通知房间内所有用户,3-通知全服)
            if (parm.Inform >= 0) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Inform` = :Inform", "AND");
            }
            //按说明查询
            if (parm.Remark) {
                parm.Remark = "%" + parm.Remark + "%";
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Remark` LIKE :Remark", "AND");
            }
            //按开始时间查询
            parm.StartDate = KOC.DateUtils.Min(parm.StartDate);
            if (parm.StartDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` >= :StartDate", "AND");
            }
            //按结束时间查询
            parm.EndDate = KOC.DateUtils.Max(parm.EndDate);
            if (parm.EndDate) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`Create_Date` <= :EndDate", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, function (retValue) {
                if (retValue.hasError || !retValue.returnObject) {
                    callback(retValue);
                    return;
                }
                var _DataList = retValue.returnObject;
                retValue.returnObject = [];
                KOC.Lodash.forEach(_DataList, function (ThisValue) {
                    ThisValue = KOC.Lodash.pick(ThisValue, [
                        "Order_No",
                        "User_ID",
                        "User_NickName",
                        "User_RealName",
                        "User_ID_Admin",
                        "User_NickName_Admin",
                        "User_RealName_Admin",
                        "Family_ID",
                        "Family_Name",
                        "Integral",
                        "Type",
                        "Operation",
                        "Inform",
                        "Remark",
                        "Create_Date",
                        "Create_IP"
                    ]);
                    ThisValue.User_RealName = KOC.StringUtils.Cover(ThisValue.User_RealName, "Name");
                    ThisValue.User_RealName_Admin = KOC.StringUtils.Cover(ThisValue.User_RealName_Admin, "Name");
                    retValue.returnObject.push(ThisValue);
                });
                callback(retValue);
            });
        },
        OrderAnchorIntegralOld_Parm: function () {
            return {
                FuzzyQuery: "",
                User_ID: -1,
                User_NickName: "",
                User_RealName: "",
                User_ID_Admin: -1,
                User_NickName_Admin: "",
                User_RealName_Admin: "",
                Family_ID: -1,
                Family_Name: "",
                Start_Integral: 0,
                End_Integral: 0,
                Type: "",
                Operation: -1,
                Inform: -1,
                StartDate: "",
                EndDate: ""
            };
        },
        //endregion
        //region OrderVip:用户购买VIP列表
        OrderVip: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col && page.Sort_Dir ? page.Sort_Col + " " + page.Sort_Dir : "";
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_vip`.`Order_No`";
            PageParm.ColumnMAX = "`order_vip`.`User_ID`";
            PageParm.ColumnList = "`order_vip`.`Order_No`" +
                ", `order_vip`.`User_ID`" +
                ", `order_vip`.`User_NickName`" +
                ", `order_vip`.`VIP_ID`" +
                ", `order_vip`.`VIP_Name`" +
                ", `order_vip`.`VIP_Value`" +
                ", `order_vip`.`VIP_Mode`" +
                ", `order_vip`.`Order_Amt`" +
                ", `order_vip`.`Create_Date`";
            PageParm.TableList = "`order_vip`";
            PageParm.Condition = "`order_vip`.`User_ID` = :User_ID ";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`VIP_Mode` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`User_NickName` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按用户ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_vip`.`User_ID` = :User_ID", "AND");
            }
            //按VIP类型查询
            if (parm.VIP_Mode) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_vip`.`VIP_Mode` LIKE :VIP_Mode", "AND");
            }
            //按创建时间时间查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_vip`.`Create_Date` >= :Create_Date_Between AND `order_vip`.`Create_Date` <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderVip_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                User_NickName: null,//用户名
                Create_Date_Between: null,//查询的开始时间
                Create_Date_And: null,//查询的结束时间
                VIP_Mode: null,//[YEAR, MONTY, WEEK, DAY]
                User_ID: -1
            };
        },
        //endregion
        //region OrderMounts:用户购买坐骑列表
        OrderMountsOld: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col && page.Sort_Dir ? page.Sort_Col + " " + page.Sort_Dir : "";
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_mounts`.`Order_No`";
            PageParm.ColumnMAX = "`order_mounts`.`User_ID`";
            PageParm.ColumnList = "`order_mounts`.`Order_No`" +
                ", `order_mounts`.`User_ID`" +
                ", `order_mounts`.`User_NickName`" +
                ", `order_mounts`.`Mounts_ID`" +
                ", `order_mounts`.`Mounts_Name`" +
                ", `order_mounts`.`Mounts_Mode`" +
                ", `order_mounts`.`Mounts_Value`" +
                ", `order_mounts`.`Mounts_Price`" +
                ", `order_mounts`.`Order_Num`" +
                ", `order_mounts`.`Order_Amt`" +
                ", `order_mounts`.`Create_Date`";
            PageParm.TableList = "`order_mounts`";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`Mounts_Mode` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_guardian`.`Mounts_Name` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按用户ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_mounts`.`User_ID` = :User_ID", "AND");
            }
            //按坐骑商品ID查询
            if (parm.Mounts_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_mounts`.`Mounts_ID` = :Mounts_ID", "AND");
            }
            //按坐骑模式查询
            if (parm.Mounts_Mode) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_mounts`.`Mounts_Mode` LIKE :Mounts_Mode", "AND");
            }
            //按坐骑单价查询
            if (parm.Mounts_Price) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_mounts`.`Mounts_Price` = :Mounts_Price", "AND");
            }
            //按购买数量查询
            if (parm.Order_Num) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_mounts`.`Order_Num` = :Order_Num", "AND");
            }
            //按创建时间时间查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_mounts`.`Create_Date` >= :Create_Date_Between AND `order_mounts`.`Create_Date` <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderMountsOld_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                Mounts_ID: null,//坐骑商品ID
                Mounts_Name: null,//坐骑商品名称
                Mounts_Mode: null,//坐骑模式：YEAR, MONTY, WEEK, DAY
                Mounts_Price: null,//坐骑单价
                Order_Num: null,//购买数量
                Create_Date_Between: null,//查询的开始时间
                Create_Date_And: null,//查询的结束时间
                User_NickName: null,//用户名称
                User_ID: -1
            };
        },
        //endregion
        //region OrderLiveOld:艺人直播数据列表
        OrderLiveOld: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col && page.Sort_Dir ? page.Sort_Col + " " + page.Sort_Dir : "";
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_live`.`Order_No`";
            PageParm.ColumnMAX = "`order_live`.`Order_No`";
            PageParm.ColumnList = "`order_live`.`Order_No`" +
                ", `order_live`.`User_ID`" +
                ", `order_live`.`User_NickName`" +
                ", `order_live`.`Family_Name`" +
                ", `order_live`.`Family_ID`" +
                ", `order_live`.`Coin`" +
                ", `order_live`.`Gift_Num`" +
                ", `order_live`.`Gift_Num_Anchor`" +
                ", `order_live`.`Gift_Num_User`" +
                ", `order_live`.`Gift_Count`" +
                ", `order_live`.`Gift_Count_Anchor`" +
                ", `order_live`.`Gift_Count_User`" +
                ", `order_live`.`Gift_Coin`" +
                ", `order_live`.`Gift_Coin_Anchor`" +
                ", `order_live`.`Gift_Coin_User`" +
                ", `order_live`.`Gift_Beans_Anchor`" +
                ", `order_live`.`Gift_Beans_Family`" +
                ", `order_live`.`Gift_Beans_User`" +
                ", `order_live`.`Gift_Beans_UserFamily`" +
                ", `order_live`.`Gift_Beans_Platform`" +
                ", `order_live`.`Gift_Pond_Count`" +
                ", `order_live`.`Gift_Pond_Coin`" +
                ", `order_live`.`Guardian_Count`" +
                ", `order_live`.`Guardian_Coin`" +
                ", `order_live`.`Guardian_Beans_Anchor`" +
                ", `order_live`.`Guardian_Beans_Family`" +
                ", `order_live`.`Guardian_Beans_Platform`" +
                ", `order_live`.`Pomelo`" +
                ", `order_live`.`Duration`" +
                ", `order_live`.`End_Date`" +
                ", `order_live`.`Create_Date`" +
                ", `order_live`.`Status`" +
                ", `user_anchor`.`Family_Commission`" +
                ", `user_anchor`.`RoomName`" +
                ", `user_anchor`.`RoomWelcome`" +
                ", `user_anchor`.`Tags`" +
                ", `user_anchor`.`Live`" +
                ", `user_anchor`.`Live_StartTime`" +
                ", `user_anchor`.`Live_Order_No`" +
                ", `user_anchor`.`Live_Duration_Total`" +
                ", `user_anchor`.`Pomelo` AS `Anchor_Pomelo`" +
                ", `user_anchor`.`Pomelo_Today` AS `Anchor_Pomelo_Today`" +
                ", `user_anchor`.`Pomelo_Week` AS `Anchor_Pomelo_Week`" +
                ", `user_anchor`.`Pomelo_Month` AS `Anchor_Pomelo_Month`" +
                ", `user_anchor`.`Pomelo_Year` AS `Anchor_Pomelo_Year`" +
                ", `user_anchor`.`EXP` AS `Anchor_EXP`" +
                ", `user_anchor`.`Create_Date` AS `Anchor_Create_Date`" +
                ", `user_anchor`.`Status` AS `Anchor_Status`";
            PageParm.TableList = "`order_live`JOIN `user_anchor`" +
                " ON `order_live`.`User_ID` = `user_anchor`.`User_ID`";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_live`.`User_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_live`.`Family_Name` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_live`.`User_ID` = :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按用户ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_live`.`User_ID` = :User_ID", "AND");
            }
            //按公会ID查询
            if (parm.Family_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_live`.`Family_ID` = :Family_ID", "AND");
            }
            //按直播状态查询
            if (parm.Status) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_live`.`Status` = :Status", "AND");
            }
            //按累计消费查询
            if (parm.Coin_Between && parm.Coin_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_live`.`Coin` >= :Coin_Between AND `order_live`.`Coin` <= :Coin_And", "AND");
            }
            //按直播时长查询
            if (parm.Duration_Between && parm.Duration_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_live`.`Duration` >= :Duration_Between AND `order_live`.`Duration` <= :Duration_And", "AND");
            }
            //按创建日期查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "DATE_FORMAT(`order_live`.`Create_Date`,'%Y-%m-%d') >= :Create_Date_Between AND DATE_FORMAT(`order_live`.`Create_Date`,'%Y-%m-%d') <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderLiveOld_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                User_NickName: null,//用户昵称
                Family_Name: null,//公会名
                User_ID: null,//用户ID
                Family_ID: null,//公会ID
                Status: null,//直播状态
                Coin_Between: null,//消费金额，从...
                Coin_And: null,//消费金额，到...
                Duration_Between: null,//直播时长，，从...
                Duration_And: null,//直播时长，到...
                Create_Date_Between: null,//查询的开始时间
                Create_Date_And: null//查询的结束时间
            };
        },
        //endregion
        //region OrderPay:交易记录列表
        OrderPay: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col && page.Sort_Dir ? page.Sort_Col + " " + page.Sort_Dir : "";
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_pay`.`Order_No`";
            PageParm.ColumnMAX = "`order_pay`.`User_ID`";
            PageParm.ColumnList = "`order_pay`.`Order_No`" +
                ", `order_pay`.`User_ID`" +
                ", `order_pay`.`User_NickName`" +
                ", `order_pay`.`Pay_Type`" +
                ", `order_pay`.`Pay_Style`" +
                ", `order_pay`.`Pay_From`" +
                ", `order_pay`.`Pay_Money`" +
                ", `order_pay`.`Pay_Coin`" +
                ", `order_pay`.`Pay_Poundage`" +
                ", `order_pay`.`Pay_TransNumber`" +
                ", `order_pay`.`Update_Date`" +
                ", `order_pay`.`Channel_ID`" +
                ", `order_pay`.`Create_IP`" +
                ", `order_pay`.`Create_Date`" +
                ", `order_pay`.`Status`";
            PageParm.TableList = "`order_pay`";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_pay`.`Pay_TransNumber` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_pay`.`User_NickName` LIKE :FuzzyQueryLike", "OR");
                if (KOC.StringUtils.ToIntPositive(parm.FuzzyQuery) > 0) {
                    _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_pay`.`User_ID` = :FuzzyQuery", "OR");
                }
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按用户ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_pay`.`User_ID` = :User_ID", "AND");
            }
            //按用户交易号
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_pay`.`Order_No` = :Order_No", "AND");
            }
            //按用户昵称查询
            if (parm.User_NickName) {
                parm.User_NickName = '%' + parm.User_NickName + '%';
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_pay`.`User_NickName` LIKE :User_NickName", "AND");
            }
            //按支付类型查询
            if (parm.Pay_Type) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_pay`.`Pay_Type` = :Pay_Type", "AND");
            }
            //按支付状态查询
            if (parm.Status == 0 || parm.Status == 1) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_pay`.`Status` = :Status", "AND");
            }
            //按支付金额查询
            if (parm.Pay_Money_Between && parm.Pay_Money_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_pay`.`Pay_Money` > :Pay_Money_Between AND `order_pay`.`Pay_Money` < :Pay_Money_And", "AND");
            }
            //按支付成功时间查询
            if (parm.Update_Date_Between && parm.Update_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_pay`.`Update_Date` >= :Update_Date_Between AND `order_pay`.`Update_Date` <= :Update_Date_And", "AND");
            }
            //按创建日期查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "DATE_FORMAT(`order_pay`.`Create_Date`,'%Y-%m-%d') >= :Create_Date_Between AND DATE_FORMAT(`order_pay`.`Create_Date`,'%Y-%m-%d') <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderPay_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                User_NickName: null,//用户昵称
                Order_No: null,//交易号
                Pay_Type: null,//支付类型 1支付宝 2汇付宝
                Pay_Money_Between: null,//支付金额，从...
                Pay_Money_And: null,//支付金额，到...
                Pay_TransNumber: null,//支付返回的交易号
                Update_Date_Between: null,//支付成功时间，从...
                Update_Date_And: null,//支付成功时间，到...
                Create_Date_Between: null,//查询下订单时间的开始时间
                Create_Date_And: null,//查询下订单时间的结束时间
                Status: null//支付状态 0:已完成 1:未支付
            };
        },
        //endregion
        //region OrderWithdraw:申请提现列表
        OrderWithdraw: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col && page.Sort_Dir ? page.Sort_Col + " " + page.Sort_Dir : "";
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_withdraw`.`Order_No`";
            PageParm.ColumnMAX = "`order_withdraw`.`Order_No`";
            PageParm.ColumnList = "`order_withdraw`.`Order_No`" +
                ", `order_withdraw`.`User_ID`" +
                ", `order_withdraw`.`Money`" +
                ", `order_withdraw`.`Revenue_Money`" +
                ", `order_withdraw`.`Real_Money`" +
                ", `order_withdraw`.`Update_Date`" +
                ", `order_withdraw`.`Create_Date`" +
                ", `order_withdraw`.`Status`" +
                ", `user_info`.`NickName`" +
                ", `user_info`.`RealName`" +
                ", `user_info`.`Email`" +
                ", `user_info`.`Phone`" +
                ", `user_info`.`QQ`" +
                ", `user_info`.`Sex`" +
                ", `user_info`.`Birthday`" +
                ", `user_info`.`Constellation`" +
                ", `user_info`.`EXP`" +
                ", `user_info`.`VIP`" +
                ", `user_info`.`VIP_Expire`" +
                ", `user_info`.`Beans`" +
                ", `user_info`.`Pomelo`" +
                ", `user_info`.`Fans`" +
                ", `user_info`.`Attention`" +
                ", `user_info`.`IsAnchor`" +
                ", `user_info`.`IsFamily`" +
                ", `user_info`.`Login_Count`" +
                ", `user_info`.`Login_This_Date`" +
                ", `user_info`.`Create_Date` AS `User_Create_Date`" +
                ", `user_anchor`.`Network`" +
                ", `user_anchor`.`Account_BankName`" +
                ", `user_anchor`.`Account_BankFullName`" +
                ", `user_anchor`.`Account_RealName`" +
                ", `user_anchor`.`Account_CardNo`" +
                ", `user_anchor`.`Account_Province`" +
                ", `user_anchor`.`Account_City`" +
                ", `user_anchor`.`IDCard`" +
                ", `user_anchor`.`Family_ID`" +
                ", `user_anchor`.`Status` AS  Anchor_Status";
            PageParm.TableList = "`order_withdraw` JOIN `user_info`" +
                " ON `order_withdraw`.`User_ID` = `user_info`.`User_ID`" +
                " LEFT JOIN `user_anchor` ON `user_info`.`User_ID` = `user_anchor`.`User_ID`" +
                " AND `user_anchor`.`Status` = 0";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_withdraw`.`Order_No` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`RealName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_info`.`Phone` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`Account_BankName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`Account_BankFullName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`Account_RealName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`user_anchor`.`Account_CardNo` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按用户ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_withdraw`.`User_ID` = :User_ID", "AND");
            }
            //按用户昵称查询
            if (parm.NickName) {
                parm.NickName = '%' + parm.NickName + '%';
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`user_info`.`NickName` LIKE :NickName", "AND");
            }
            //按单据号查询
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_withdraw`.`Order_No` = :Order_No", "AND");
            }
            //按支付状态查询
            if (parm.Status == 0 || parm.Status == 1) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_withdraw`.`Status` = :Status", "AND");
            }
            //按支付成功时间查询
            if (parm.Update_Date_Between && parm.Update_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "DATE_FORMAT(`order_withdraw`.`Update_Date`,'%Y-%m-%d') >= :Update_Date_Between AND DATE_FORMAT(`order_withdraw`.`Update_Date`,'%Y-%m-%d')<= :Update_Date_And", "AND");
            }
            //按创建日期查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "DATE_FORMAT(`order_withdraw`.`Create_Date`,'%Y-%m-%d') >= :Create_Date_Between AND DATE_FORMAT(`order_withdraw`.`Create_Date`,'%Y-%m-%d')<= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderWithdraw_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                User_ID: null,//用户ID
                Order_No: null,//订单号
                NickName: null,//用户昵称
                Account_BankName: null,//开户行名称
                Account_BankFullName: null,//开户的具体地址
                Account_RealName: null,//开户人姓名
                Account_CardNo: null,//开户行卡号
                Update_Date_Between: null,//结算，从...
                Update_Date_And: null,//结算，到...
                Create_Date_Between: null,//查询时间的开始时间
                Create_Date_And: null,//查询时间的结束时间
                Status: null//支付状态 0:已完成 1:未支付
            };
        },
        //endregion
        //region OrderBankManage:后台管理资金交易列表
        OrderBankManage: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_bankmanage`.`Order_No`";
            PageParm.ColumnMAX = "`order_bankmanage`.`Order_No`";
            PageParm.ColumnList = "`order_bankmanage`.`Order_No`" +
                ", `order_bankmanage`.`Admin_ID`" +
                ", `order_bankmanage`.`NickName`" +
                ", `order_bankmanage`.`RealName`" +
                ", `order_bankmanage`.`Related_Type`" +
                ", `order_bankmanage`.`Related_ID`" +
                ", `order_bankmanage`.`Related_NickName`" +
                ", `order_bankmanage`.`Trade_Flag`" +
                ", `order_bankmanage`.`Trade_Currency`" +
                ", `order_bankmanage`.`Trade_Amt`" +
                ", `order_bankmanage`.`Remark`" +
                ", `order_bankmanage`.`Create_Date`" +
                ", `order_bankmanage`.`Create_IP`";
            PageParm.TableList = "`order_bankmanage`";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_bankmanage`.`Order_No` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_bankmanage`.`NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_bankmanage`.`RealName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_bankmanage`.`Related_NickName` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_bankmanage`.`Remark` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按Order_No查询
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Order_No` = :Order_No", "AND");
            }
            //按操作用户ID查询
            if (parm.Admin_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Admin_ID` = :Admin_ID", "AND");
            }
            //按被操作用户ID查询
            if (parm.Related_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Related_ID` = :Related_ID", "AND");
            }
            //按操作用户昵称查询
            if (parm.NickName) {
                parm.Family_Name = '%' + parm.Family_Name + '%';
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`NickName` LIKE :NickName", "AND");
            }
            //按被操作用户昵称查询
            if (parm.Related_NickName) {
                parm.Family_Name = '%' + parm.Family_Name + '%';
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Related_NickName` LIKE :Related_NickName", "AND");
            }
            //按操作对象类型查询
            if (parm.Related_Type) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Related_Type` = :Related_Type", "AND");
            }
            //按加减类型查询
            if (parm.Trade_Flag) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Trade_Flag` = :Trade_Flag", "AND");
            }
            //按币种类型查询
            if (parm.Trade_Currency) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Trade_Currency` = :Trade_Currency", "AND");
            }
            //按交易资金数量查询
            if (parm.Trade_Amt) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Trade_Amt` = :Trade_Amt", "AND");
            }
            //按创建日期查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_bankmanage`.`Create_Date` >= :Create_Date_Between AND `order_bankmanage`.`Create_Date` <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        OrderBankManage_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                Order_No: null,//订单号
                Admin_ID: null,//操作用户ID
                NickName: null,//操作用户昵称
                RealName: null,//操作用户真实姓名
                Related_ID: null,//相关用户ID
                Related_NickName: null,//相关用户昵称
                Remark: null,//备注
                Related_Type: null,//操作用户类型
                Trade_Flag: null,//加减类型
                Trade_Currency: null,//币种类型
                Trade_Amt: null,//交易资金
                Create_Date_Between: null,//查询开始时间
                Create_Date_And: null,//查询结束时间
            };
        },
        //endregion
        //region Order_Lottery:抽奖活动的中奖列表列表
        Order_Lottery: function (parm, page, callback) {
            var PageParm = new Mysql_Helper.PageParm();
            PageParm.Cache = page.Cache;
            PageParm.Start = page.Start;
            PageParm.Length = page.Length;
            PageParm.OrderName = page.Sort_Col + " " + page.Sort_Dir;
            PageParm.GetPageInfo = page.GetPageInfo;
            PageParm.ColumnPK = "`order_lottery`.`Order_No`";
            PageParm.ColumnMAX = "`order_lottery`.`Order_No`";
            PageParm.ColumnList = "`order_lottery`.`Order_No`" +
                ", `order_lottery`.`User_ID`" +
                ", `order_lottery`.`User_NickName`" +
                ", `order_lottery`.`User_RealName`" +
                ", `order_lottery`.`User_ID_Anchor`" +
                ", `order_lottery`.`Order_Amt`" +
                ", `order_lottery`.`Count`" +
                ", `order_lottery`.`Category`" +
                ", `order_lottery`.`Winning_Amt`" +
                ", `order_lottery`.`Winning_Amt_Virtual`" +
                ", `order_lottery_winning`.`Winning_Type`" +
                ", `order_lottery_winning`.`Winning_ID`" +
                ", `order_lottery_winning`.`Winning_Mode`" +
                ", `order_lottery_winning`.`Winning_Value`" +
                ", `order_lottery_winning`.`Winning_Amt` AS `Item_Winning_Amt`" +
                ", `order_lottery_winning`.`Winning_Amt_Virtual` AS `Item_Winning_Amt_Virtual`" +
                ", `order_lottery_winning`.`Winning_Text`" +
                ", `order_lottery`.`Create_Date`" +
                ", `order_lottery`.`Create_IP`";
            PageParm.TableList = "`order_lottery` JOIN `order_lottery_winning`" +
                " ON `order_lottery`.`Order_No` = `order_lottery_winning`.`Order_No`";
            if (!PageParm.OrderName || PageParm.OrderName == "" || PageParm.OrderName == undefined) {
                PageParm.OrderName = "Create_Date" + " " + "DESC";
            }
            if (page.MaxCode && !PageParm.GetPageInfo) {
                parm.MaxCode = page.MaxCode;
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, PageParm.ColumnMAX + " <= :MaxCode", "AND");
            }
            //模糊查询
            parm.FuzzyQuery = KOC.StringUtils.ToString(parm.FuzzyQuery);
            if (parm.FuzzyQuery.trim()) {
                parm.FuzzyQueryLike = "%" + parm.FuzzyQuery.trim() + "%";
                var _Condition_FuzzyQuery = "";
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_lottery`.`Order_No` LIKE :FuzzyQueryLike", "OR");
                _Condition_FuzzyQuery = Mysql_Helper.AddToWhereSQL(_Condition_FuzzyQuery, "`order_lottery`.`User_NickName` LIKE :FuzzyQueryLike", "OR");
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, _Condition_FuzzyQuery, "AND");
            }
            //按Order_No查询
            if (parm.Order_No) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_lottery`.`Order_No` = :Order_No", "AND");
            }
            //按操作用户ID查询
            if (parm.User_ID) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_lottery`.`User_ID` = :User_ID", "AND");
            }
            //按创建日期查询
            if (parm.Create_Date_Between && parm.Create_Date_And) {
                PageParm.Condition = Mysql_Helper.AddToWhereSQL(PageParm.Condition, "`order_lottery`.`Create_Date` >= :Create_Date_Between AND `order_lottery`.`Create_Date` <= :Create_Date_And", "AND");
            }
            Mysql_Helper.Page(DBName, PageParm, parm, callback);
        },
        Order_Lottery_Parm: function () {
            return {
                FuzzyQuery: null,//模糊查询
                Order_No: null,//订单号
                User_ID: null,//操作用户ID
                User_NickName: null,//操作用户昵称
                User_RealName: null,//操作用户真实姓名
                Winning_Text: null,
                Winning_Mode: null,
                IsWinning: null,
                Create_Date_Between: null,//查询开始时间
                Create_Date_And: null,//查询结束时间
            };
        }
        //endregion
    }
    //endregion
};